ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Virkus <rob...@enough.de>
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:

BootClasspath=/home/enough/workspace/enough-polish-build/import/midp1.jar:/home/enough/workspace/enough-polish-build/import/midp2.jar

whereas in the first round this is set:

BootClasspath=/home/enough/workspace/enough-polish-build/import/midp1.jar

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



On Friday 25 February 2005 21:35, Stefan Bodewig wrote:
> On Fri, 25 Feb 2005, Robert Virkus <robert@enough.de> 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 org.apache.tools.ant.taskdefs.Javac 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: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org

-- 
Robert Virkus
Enough Software
Vor dem Steintor 218
28203 Bremen
Germany

www.enough.de
+49-(0)421-9889131
+49-(0)160-7788203
robert@enough.de

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


Mime
View raw message