MyThinkPond

On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

Notable difference between Apache Ant 1.7.x and 1.8.x – path and pathelement

Posted by Venkatt Guhesan on July 21, 2010

On key notable difference I’m observing between Apache Ant 1.7.1 and 1.8.1 is with the path and pathelement.

a build.xml file before

===========================
<target name=”init”>
     <property name=”web.dir” value=”web” />
     <path id=”servlet.class.path”>
        <pathelement location=”${TOMCAT_HOME}/lib/servlet.jar” />       
    </path>
</target>
===========================

If you had a path-id set in a target that may never get executed, Ant will make an attempt to find that path and use it. Whereas with 1.8.1, you will need to move those “Init” properties to the main level so that they will be properly found and used.

build.xml file after Ant 1.8.1

===========================
<property name=”web.dir” value=”web” />
<path id=”servlet.class.path”>
    <pathelement location=”${TOMCAT_HOME}/lib/servlet.jar” />       
</path>

<target name=”init”>
</target>
===========================

I guess Ant is making it more like a language that if a property is set within a “target”, it’s only accessable within that target.

And so the properties and path-id fields need to be set globally at the main level.

Any thought? or comments?

Advertisements

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: