You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Fabrizio Giustina <fg...@sapient.it> on 2004/05/13 23:51:36 UTC

maven-ant-clover classloader voodoo

I spent some time trying to fix a problem in the clover plugin and I
couldn't find a working solution...

The clover plugin actually doesn't work if you set the
"maven.clover.jar" property with a registered clover jar with a version
different from the one loaded by the plugin (1.2.3). The problem is
really annoying since, if you get a new registered version from Cortex,
there is no way to get an old 1.2.3 registed jar. It can work replacing
the jar directly in the repository, but I was looking for a more
definitive solution.


The problem is:
- the plugin loads the clover jar in the root classloader. This version
is used for the first step (compiling instrumented classes)
- the registered clover jar is added to the classpath (using
<maven:addPath>) and used to run the instrumented classes
- ... lots of method not found errors are thrown since classes
compilated with the 2 version are not compatible


So I tried removing the root classloader from the plugin dependency and
fixing the plugin script to always include the correct jar in the
classpath.
But for the first step nothing can be done, since clover is setting the
ant build.compiler property and ant looks for the specified compiler
only in the root classloader (you get a "Compiler Adapter
'org.apache.tools.ant.taskdefs.CloverCompilerAdapter' can't be found."
If it's not there)
It seems that the classpath supplied to the javac task doesn't affect
how ant looks for the build compiler (no way to set up a classpath like
we do for the taskdef task)

So, is there any hack to make it working properly (now, without waiting
for m2, please)?
Any way to dynamically set a jar in the root classloader, like we do
using <maven:addPath>? Or another way to make ant seeing classes not in
maven/lib?
Any hint?


fabrizio

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