You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Nate Drake <nd...@gmail.com> on 2011/07/28 05:19:07 UTC

Unable to override system properties with 1.8.2

Our build file uses the user.name property to let developers customize
property values.  We then use -D to override user.name when doing builds for
dev/production servers.  When using any version of Ant before 1.8.2 this
works without issue.  With 1.8.2, user.name won't be overridden with what we
passed on the command line via -D.  Other non-system properties can
be successfully overridden via -D.  I did some searching in the release
notes and didn't see any changes that would cause this to happen.  Is this a
known issue? Is there a way to get the old behavior back in 1.8.2?

Thanks,

Nate

Here is a simple build file to test with:

<?xml version="1.0"?>
<project name="anttest" default="test" basedir=".">

    <!-- Override user.name for other properties to be loaded with a
-Duser.name=blah -->
    <echo message="using properties for user.name: ${user.name} loading prop
file: properties/${user.name}.properties"/>
    <property file="properties/${user.name}.properties"/>

    <property name="someprop" value="setInBuild"/>

    <target name="test">
        <echo message="user.name = ${user.name}"/>
        <echo message="java.vendor = ${java.vendor}"/>
        <echo message="someprop = ${someprop}"/>
    </target>

</project>

Re: Unable to override system properties with 1.8.2

Posted by Martin Raie <ma...@gmail.com>.
I created a bug report about it
https://issues.apache.org/bugzilla/show_bug.cgi?id=51792

2011/9/9 Nate Drake <nd...@gmail.com>

> Sorry, this fell off my radar.  I didn't create a bug report for it yet.
>
> On Fri, Sep 9, 2011 at 10:18 AM, martinraie <ma...@gmail.com> wrote:
>
> > I ran into the exact same problem today. Did you find out if it's a bug
> or
> > a
> > feature? Or did you open a bug report?
> >
> > --
> > View this message in context:
> >
> http://ant.1045680.n5.nabble.com/Unable-to-override-system-properties-with-1-8-2-tp4641134p4786521.html
> > Sent from the Ant - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>

Re: Unable to override system properties with 1.8.2

Posted by Nate Drake <nd...@gmail.com>.
Sorry, this fell off my radar.  I didn't create a bug report for it yet.

On Fri, Sep 9, 2011 at 10:18 AM, martinraie <ma...@gmail.com> wrote:

> I ran into the exact same problem today. Did you find out if it's a bug or
> a
> feature? Or did you open a bug report?
>
> --
> View this message in context:
> http://ant.1045680.n5.nabble.com/Unable-to-override-system-properties-with-1-8-2-tp4641134p4786521.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Unable to override system properties with 1.8.2

Posted by martinraie <ma...@gmail.com>.
I ran into the exact same problem today. Did you find out if it's a bug or a
feature? Or did you open a bug report?

--
View this message in context: http://ant.1045680.n5.nabble.com/Unable-to-override-system-properties-with-1-8-2-tp4641134p4786521.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Unable to override system properties with 1.8.2

Posted by Stefan Bodewig <bo...@apache.org>.
On 2011-07-28, Nate Drake wrote:

> Our build file uses the user.name property to let developers customize
> property values.  We then use -D to override user.name when doing builds for
> dev/production servers.  When using any version of Ant before 1.8.2 this
> works without issue.  With 1.8.2, user.name won't be overridden with what we
> passed on the command line via -D.  Other non-system properties can
> be successfully overridden via -D.  I did some searching in the release
> notes and didn't see any changes that would cause this to happen.  Is this a
> known issue?

I don't recall it to be a conscious change.  Could you open a bug report
for it?

> Is there a way to get the old behavior back in 1.8.2?

You could set the properties as system properties to the Java VM rather
than arguments to Ant.  I.e. you'd pass them in the ANT_OPTS environment
variable rather than as command line arguments.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org