ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <rhi...@sympatico.ca>
Subject ${ant.home} partly broken in Ant 1.6.2 - also ${ant.library.dir}
Date Tue, 04 Jan 2005 15:40:45 GMT
I'm experiencing some weird behaviour with respect to certain ant properties
in my build.xml. I think this behaviour warrants a Bug Report but the manual
says I should discuss the issue with the mailing list first. It suggests
trying to get some concensus that it really is a bug first and that other
people are experiencing it too.

So here's my problem.

My build.xml is trying to use the 'import' task to bring in some routines
that I plan to use in all of my build.xml files from now on. I have placed
these routines in a subdirectory called 'imports' which is below my ant.home
directory. I construct a property called 'import.path' and define it as
'${ant.home}/imports'. Then, I use the 'import.path' property in the
'import' tasks.

<!--==================================================================

Import common code.

==================================================================-->

<property name="import.path" value="${ant.home}\imports"/>

<import file="${import.path}\sounds.xml" description="Play appropriate
sounds depending on whether build worked or failed."/>

<import file="${import.path}\datetime.xml" description="Display date and
time that build started."/>


For some reason, Ant 1.6.2 cannot see the routines in my 'imports'
directory: the Ant Editor in Eclipse puts a yellow line under both 'import'
tasks and complains that it can't see the files I'm trying to import, even
though they are present beneath ant.home and have the exact names that I am
specifying.

After some experimentation, I have discovered that the problem is easily
worked around by removing '${ant.home}' from the definition of 'import.path'
and replacing it with the full path, as shown here:

<!--==================================================================

Import common code.

==================================================================-->

<!--property name="import.path" value="${ant.home}\imports"/-->

<property name="import.path"
value="e:\eclipse\3.0.1\eclipse\plugins\org.apache.ant_1.6.2\imports"/>

<import file="${import.path}\sounds.xml" description="Play appropriate
sounds depending on whether build worked or failed."/>

<import file="${import.path}\datetime.xml" description="Display date and
time that build started."/>


It appears that Ant 1.6.2 is having some kind of serious problem seeing the
value of 'ant.home'.

On further investigation, I found that Ant 1.6.2 isn't seeing
'ant.library.dir' either. (I copied the 'imports' folder under
'ant.library.dir' and changed ${ant.home} to ${ant.library.dir} in my
build.xml: again, the two routines (sounds.xml and datetime.xml) were not
seen by the Ant Editor in Eclipse. However, when I changed ${ant.home} to
${sun.boot.library.path} (and copied the 'imports' folder under it), the
imports were seen just fine.

'ant.home' and 'ant.library.dir' are the only two ant properties that are
directories and the expressions '${ant.home}' and '${ant.library.dir}' both
appear to be broken in Ant 1.6.2. I'm not sure exactly HOW they are broken
since echoproperties still shows these two properties (and all of the other
ant, sun, and java properties) and they appear to be correct but they
clearly don't work in expressions.

I should also mention that this problem only happens within Ant 1.6.2 in
Eclipse. It doesn't happen in Ant 1.6.1 when accessed on the command line.
(I have Ant 1.6.2 built into Eclipse 3.0.1 and have a separate copy of Ant
1.6.1 installed outside of Eclipse.)

So, where do we got from here? I suppose I should ask if a few of you could
confirm that this problem occurs for you too and then file a bug report.

If others can duplicate this problem, will 1.6.2 be fixed or does the bug
report simply ensure that the next version, 1.7, is investigated to ensure
that it doesn't have this problem?

As for workarounds, I will simply make sure that my build.xml files avoid
using ${ant.home} or ${ant.library.dir} in property values as long as I use
1.6.2 and specify the full path explicitly until this problem is resolved.

Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare


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


Mime
View raw message