You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jason Rosenberg <ja...@squaretrade.com> on 2000/12/13 09:57:10 UTC

property value resetting...

It seems that once a property has its value set, it cannot be set to
a new value subsequently.  Is that right?

I have 2 targets:

<target name="compile">
  <property name="extension" value="java"/>
  <javac srcdir="${basedir}" target="${JAVA_JDK_VERSION}">
    &sourcePattern; 
  </javac>
</target>

<target name="distribute" depends="compile">
  <property name="extension" value="class"/>
  <copy todir="${DISTRIBUTE_PLUGIN_CLASSES}">
   <fileset dir="${basedir}">
    &sourcePattern; 
   </fileset>
  </copy>
</target>

The entity sourcePattern is defined in terms of the extension property:

 <!ENTITY sourcePattern '
  <patternset>
   <include name="&buildDir;/EventTime.${extension}"/>
   <include name="&buildDir;/EventOutMail.${extension}"/>
  </patternset>
 '>

When I do the distribute target, which depends on compile, it attempts
to copy the *.java and not the *.class versions of the files.
Is that right?  I would have wanted the "extension" property value
to be reset in each target, but that doesn't appear to be happening.

The docs are unclear in this case.  Is it meant to be resettable,
or not, and if not, why not.  It would certainly make life easier to
have this abillity.

Jason

Re: property value resetting...

Posted by Peter Donald <do...@apache.org>.
At 06:51  13/12/00 -0500, Jason Rosenberg wrote:
>I'm not sure I understand your response.
>
>What do you mean by "Not using <property>, yes"?
>
>I just want to know is there a way to change the
>value of a property in Ant...

Not unless you write your own task or use scripting. If you write your own
task you can easily change properties (look to property task as example) or
you can use a script (see docs for example) to do it.

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*


Re: property value resetting...

Posted by Stefan Bodewig <bo...@apache.org>.
Jason Rosenberg <ja...@squaretrade.com> wrote:

> What do you mean by "Not using <property>, yes"?

I mean that you can write a task that invokes Project.setProperty
either using Java or <script>.

> I just want to know is there a way to change the
> value of a property in Ant...

Yes, but no easy built-in way.

Stefan

Re: property value resetting...

Posted by Jason Rosenberg <ja...@squaretrade.com>.
I'm not sure I understand your response.

What do you mean by "Not using <property>, yes"?

I just want to know is there a way to change the
value of a property in Ant...

Jason

----- Original Message ----- 
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Wednesday, December 13, 2000 4:20 AM
Subject: Re: property value resetting...


> Jason Rosenberg <ja...@squaretrade.com> wrote:
> 
> > It seems that once a property has its value set, it cannot be set to
> > a new value subsequently.  Is that right?
> 
> Not using <property>, yes. Ant2 will be different.
> 
> Stefan


Re: property value resetting...

Posted by Stefan Bodewig <bo...@apache.org>.
Jason Rosenberg <ja...@squaretrade.com> wrote:

> It seems that once a property has its value set, it cannot be set to
> a new value subsequently.  Is that right?

Not using <property>, yes. Ant2 will be different.

Stefan