ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Glanville" <dic...@nortelnetworks.com>
Subject RE: Having a problem with the classpath passed to <javac> task
Date Mon, 04 Dec 2000 17:06:14 GMT


> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> Sent: Monday, December 04, 2000 9:43 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: Having a problem with the classpath passed to 
> <javac> task
> 
> 
> Jay Glanville <dickon@nortelnetworks.com> wrote:
> 
> > I am trying to compile my source code to a target 1.1 VM.  The
> > compilers I like to use are Jikes and javac 1.3.  My problem is that
> > when I use the <javac> task in conjunction with a 1.3 runtime
> > environment, the tools.jar file gets included in the classpath if
> > I'm using the modern compiler, and tools.jar and rt.jar if I'm using
> > the jikes compiler.  This is the major reason that I cannot use Ant
> > in my build environment.
> 
> This is a known problem and you'll probably have attributes in <javac>
> to suppress this behavior in Ant 1.3.

Just out of couriosity, what is the proposed timeframe for release 1.3?

> > Is there anything I can do to solve this problem (excluding having
> > to use a <exec> task) ?
> 
> As a workaround, write your own implementation of Javac, a very simple
> and untested idea:
> 
> public class MaJavac extends Javac {
>     protected Path getCompileClasspath(boolean addRuntime) {
>         return super.getCompileClasspath(false);
> }
> 
> This will suppress rt.jar even when compiling with Jikes. You can copy
> what Javac's getCompileClasspath does and omit the line
> 
>         classpath.addExisting(Path.systemClasspath);
> 
> to get rid of tools.jar as well.
> 
> At the top of your buildfile say
> 
> <taskdef name="javac" classname="MyJavac" />
> 
> and you are done.
> 
> > While I'm on the subject of unwanted stuff in the classpath, is
> > there any way that I can get rid of the ant libraries?  I know that
> > there is very little chance of namespace collisions, or any other
> > worries.  But it would be nice to simply have the following as an
> > execution line: jikes -d F:\test\classes -classpath
> > C:\jdk\1.1.8\lib\classes.zip;F:\test\classes;F:\test\src
> 
> Yes, the second option above (omitting Path.systemClasspath) should do
> that as well.
> 
> You could as well add options to (1) omit the runtime libraries and
> (2) omit the CLASSPATH Ant has been invoked with to Javac, make the
> modifications necessary to getCompileClasspath and contribute the
> patch so you will see this feature in CVS sooner 8-).

I've just been reading over the ant-dev lists, and it appears that Diane
might have already made the changes (just not submitted them).  Is that the
case Diane?  Baring that, I will seriously consider it.

> 
> Stefan
> 

Thanks.
Jay

PS: I'm just going to repost my previous PS again, incase you know the
answer of the top of your head:  How do I set the value of an attribut to be
"" (two double quotes)?  I've tried extdirs="\"\"", but that didn't work.

Mime
View raw message