Home > Apache Ant, General, Technology > Ant – Pass values from one target to other

Ant – Pass values from one target to other


Recently I faced an issue with ant script, which I thought should ‘ve been resolved in no time but took me almost a day to resolve!

I had a property defined globally… Using Ant-Contrib I reset the property value in Target1, and I wanted to reuse the updated property value in Target2. Now this is something not straight forward in Ant. In ant all the properties once defined can’t be changed (immutable), but courtesy Ant-Contrib I was able to reset the value using below option (rather cake walk!)

<ac:var name=”current.dir.name” unset=”true”/>

where ‘ac’ is Ant-Contrib name space as defined in my previous articles on ant

It took me some time to peep through the documentation of Ant and there I came across attribute ‘inheritAll‘.

inheritAll is by default set to false, setting it to true made that variable available in Target2!

That’s it!

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: