You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ernst de Haan <zn...@FreeBSD.org> on 2004/01/13 23:54:59 UTC
versus -lib for s: Official statement?
IMHO an Ant buildfile should always be able to instruct Ant with regard to
the CLASSPATH to use for <taskdef/>s.
What I mean is that if a task (like <junit/>) needs a certain CLASSPATH,
then the writer of the Ant build script should be able to specify where the
necessary classes can be found (the junit.jar file in the case of JUnit).
So instead of requiring the buildfile _executor_ having to specify the -lib
command-line argument, the buildfile _author_ should be able to use a
<classpath/>.
Also, it should not have to be necessary to have the pertaining JAR files in
the Ant lib/ directory. An author of the buildfile (like myself) will
typically want to create a self-sufficient buildfile and not have a list of
X dependencies for the buildfile executor to comply to. The environment of
the buildfile executor should be independent as much as possible from the
running of the buildfile.
Q: Is there an official statement on this subject?
Currently with Ant 1.6.0, I find it annoying that I know at build authoring
time where the necessary JAR files are located, but it is not until build
time that I can specify this location.
For a testcase use the attached buildfiles to do the following:
1. Clean your CLASSPATH environment variable and make sure junit.jar is not
in ${ANT_HOME}/lib or anywhere else in the Ant CLASSPATH.
2. Run 'ant -f build1.xml'.
Notice that the buildfile correctly states that JUnit is not available.
If you get no error, then the junit.jar is in the Ant CLASSPATH somewhere,
please fix that. Otherwise you're okay, continue with step 3.
3. Run 'ant -f build1.xml -lib <dir>', where <dir> is a directory that
contains junit.jar. Notice that the build is now successful. We can specify
the correct CLASSPATH
4. Run 'ant -f build2.xml -Ddir=<dir>', where <dir> is again a directory
that contains junit.jar. Notice that the check for the required class (line
6-11) succeeds, but the <taskdef/> (line 12) fails.
IMO test 4 should probably succeed instead of fail.
Ernst
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: versus -lib for s: Official statement?
Posted by Ernst de Haan <zn...@FreeBSD.org>.
[...]
> For a testcase use the attached buildfiles to do the following:
[...]
And here they really are...
Ernst
Re: versus -lib for s: Official statement?
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 13 Jan 2004, Ernst de Haan <zn...@freebsd.org> wrote:
> IMHO an Ant buildfile should always be able to instruct Ant with
> regard to the CLASSPATH to use for <taskdef/>s.
It can, except for the one situation where the task we are talking
about is on the system CLASSPATH or inside a directory specified with
-lib (that includes ANT_HOME/lib).
> What I mean is that if a task (like <junit/>) needs a certain
> CLASSPATH, then the writer of the Ant build script should be able to
> specify where the necessary classes can be found (the junit.jar file
> in the case of JUnit).
You can, at the cost of removing ant-junit.jar from ANT_HOME/lib and
putting it into the <classpath> as well.
> Q: Is there an official statement on this subject?
Not sure about *official*, that kind of statement is difficult to get
from a loose group of developers. Consider the FAQ entry as a
description of how things are and why they are the way they are.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org