ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <jakarta-...@ehatchersolutions.com>
Subject Re: Modifying properties on the fly in custom task
Date Sat, 31 Aug 2002 00:14:47 GMT
Since you are embedding the <exec> task within your class, you are 
bypassing Ant's property expansion mechanism.

I actually referred back to my book for the answer (why memorize the 
details when you can look them up easily?! :).... p. 485:

getProject().replaceProperties(someString)

Use the results of that to pass to the arg. method.  But, I'm a bit 
confused on exactly how you're doing what you say you're doing.  How are 
you *changing* the value of MYVAR?  You're mutating immutable 
properties?!  (which can be done, but not necessarily a good thing to do).

Is <mytask> a TaskContainer?  Or are you reimplementing the <exec> 
interface yourself?  There may be better ways to accomplish what you're 
after - elaborate a bit and lets work through it.

	Erik


Andres Valenciano wrote:
> Hi.
> 
> I am writing a Task that has as a child an exec task. In my execute method I
> am changing properties and calling the perform method on the exectask added,
> this done 1 or more times before my execute finishes.
> 
> Now, the problem I am having is that the exectask is not getting the
> "dynamically" created properties that I am using in the arg element.
> 
> For example:
> <mytask name="MYTASK"  >
> 	<exec executable="notepad.exe"  >
> 		<arg line=" ${MYVAR}"/>
> 	</exec>
> </mytask>
> 
> I am executing several times the exec task changing the MYVAR variable, BUT
> the verbose output when running the script is:
> 	Executing 'notepad.exe' with arguments:
> 	'${MYVAR}'
> 
> Any idea about how to do it? Is the exec task building the arguments before
> the perform method?
> 
> 
> Thanks for your help!
> 
> 
> A.V.
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 
> 
> 



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


Mime
View raw message