ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: ant overloading javac classpath?
Date Fri, 24 May 2002 18:39:10 GMT

----- Original Message -----
From: "Mike Cepek" <mcepek@smsi.com>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Friday, May 24, 2002 10:58 AM
Subject: ant overloading javac classpath?


> When I use -verbose to see what classpath ant is using for javac, I get
> the following (reformatted for readability):
>
>  [javac] Compilation args: javac
>    -d C:\mike\cvs\netbeans\smsi\src\java\classes
>    -classpath C:\mike\cvs\netbeans\smsi\src\java\classes
>      ;C:\SMSIHome\third-party\xerces\v1.4.4\lib\xerces.jar
>      ;C:\SMSIHome\third-party\xerces\v1.4.4\lib\xercesSamples.jar
>      ;C:\jdk1.3.1\lib\tools.jar
>      ;C:\programs\ant\jakarta-ant-1.4.1\lib\ant1.4.1-optional.jar
>      ;C:\programs\ant\jakarta-ant-1.4.1\lib\crimson.jar
>      ;C:\programs\ant\jakarta-ant-1.4.1\lib\jaxp.jar
>      ;C:\programs\ant\jakarta-ant-1.4.1\lib\ant.jar
>    -sourcepath [...]
>
> The first one (...\java\classes) comes from my javac/destdir setting.
>
> The next two (...\lib\xerces*) are from my javac/classpath[ref] setting.
>
> The remaining ones apparently come from the script that starts ant up,
> which appends some jars onto any system environment CLASSPATH settings
> (unless they don't exist on the filesystem).
>
> And upon further experimentation I have learned to turn it off with
> build.sysclasspath="ignore".
>
> However, it leads me to this question:
>
>    Why does ant include all these extra JARs just because
>    I want to use the CLASSPATH from my environment?

ant needs all the jars in its classpath to work. they trickle into <javac>
for historical reasons; there is a switch to stop it doing that.

> This isn't a major problem, of course.  One drawback I see is that the
> classpath for my javac becomes longer than necessary (confusing, and a
> problem under any O/S with a command line length limit).

up, how else can

>
> Another drawback would be the potential for conflicting JARs (e.g.
> jaxp.jar -- what if I'm using a different version of the javax.xml
> package?).

plenty much, and there is no good solution for that, anywhere, especially
not in java1.4
so
-set includeantruntime=false
-reference your own XML stuff

remember, this is only in <javac>, not <java> with supplied classpath

> I'm just curious about the rationale behind Ant appending its JARs (and
> tools.jar!) to my CLASSPATH.

It isnt; Ant is appending them to its classpath.


--
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