ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <co...@cortexebusiness.com.au>
Subject RE: task with arbitrary classpath
Date Tue, 13 Jun 2000 23:06:32 GMT
Jim,

If you have a look at my Weblogic classes (ejbc and ddcreator) which I
posted a while back, you will see that the ant Task creates a separate
helper JVM to do the work. The necessary parameters are passed as command
line arguments to the helper JVM which runs a helper class. The classpath of
this JVM can be directly controlled, which was the reason I chose to do it
that way.

The relevant code is

String systemClassPath = System.getProperty("java.class.path");
String execClassPath = project.translatePath(systemClassPath + ":" +
classpath);
Java ddCreatorTask = new Java();
ddCreatorTask.setProject(project);
ddCreatorTask.setFork("yes");
ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.DDCreator
Helper");
ddCreatorTask.setArgs(args);
ddCreatorTask.setClasspath(execClassPath);

Note that I add the classpath which has been used to invoke ant so that the
helper class can be found by the helper JVM.

Let me know if you need more info.

Conor


--
Conor MacNeill
conor@cortexebusiness.com.au
Cortex eBusiness
http://www.cortexebusiness.com.au

> -----Original Message-----
> From: Jim Stiefel [mailto:jim.stiefel@cubus.net]
> Sent: Wednesday, 14 June 2000 7:53
> To: ant-dev@jakarta.apache.org
> Subject: task with arbitrary classpath
>
>
> I am faced with an interesting problem I hope someone with more
> experience with ant might be able to help me solve.  I want to define a
> new ant task that will compare serial version UID's of freshly compiled
> classes to the same class files in a known baseline jar so that my build
> process can flag problems in serialization compatibility between our
> development version and our last release version.
>
> Retrieving the Serial Version UID is easy enough using
> java.io.ObjectStreamClass. The challenge is that the operation needs to
> be run twice with different classpaths.  In one case,  the classpath
> needs to include the baseline jar,  while in the second case,  it needs
> to include the newly built jar.
>
> Can someone suggest a simple or elegant way to accomplish this?
>
> Thanks,
>  Jim
>
>


Mime
View raw message