ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Virkus <>
Subject Re: Duplicate Class Error when Re-using Javac Task
Date Sat, 26 Feb 2005 09:24:35 GMT
Hi Stefan, Dominique, and all,

the classpath is fine, but it isn't set for the two target devices anyhow - so 
in both rounds it is empty. The bootclasspath, however, is appended (the 
first device is a MIDP/1.0 device, the second one a MIDP/2.0 one), so in the 
second round I have something like this:


whereas in the first round this is set:


This is not causing the current trouble (since all the "duplicate 
class"-errors are in neither of both JAR files), though it will propably 
become a problem later onwards.

So re-using the Javac task seems not to be possible. 

So what could I do? I now would create a "wrapper"-task that accepts all 
attributes as well as nested elements just like the Javac task, so that I 
could instantiate a fresh Javac for each round. Apart from the necessary work 
this approach means that I have to update the wrapper-task each time the 
Javac task is changed. So is there a better approach? For such cases I'd love 
to see a generic Task.newTaskInstance()...  method ;-)

Thanks again,

On Friday 25 February 2005 21:35, Stefan Bodewig wrote:
> On Fri, 25 Feb 2005, Robert Virkus <> wrote:
> > The background of this is that I have a preprocessor that creates
> > different source code versions of the same project, which are then
> > compiled by the task. I use and
> > set different directories for the source code and for the compiled
> > classes in each run. The first round is compiled without any
> > problems, but the following round fails with the "duplicate class"
> > error.
> Sounds as if the defined classpath gets poluted with your source
> directory.  Can you compare the result of Javac#getClasspath before
> and after invoking execute?
> Stefan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Robert Virkus
Enough Software
Vor dem Steintor 218
28203 Bremen

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message