You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by drekka <de...@aegeon.com.au> on 2007/02/02 00:04:29 UTC

Custom class loader issue and cobertura plugin

Hi all, a few weeks ago I wrote my own JUnit4.x plugin which has been working
perfectly. But yesterday I added cobertura to a pom and the plugin stopped
working. Whenever cobertura is added the Junit4 plugin's classloader claims
it cannot locate the compiled/instrumented classes. Turning on debug I can
see that the cobertura plugin jumps in and re-assigns the projects tart
class directory as follows:

Without cobertura: <project>/target/classes
With cobertura: <target>/generated-classes/cobertura

I cannot see any difference in the directories cobertura generates and my
class loader seems to think they are fine as this dump shows. The plugin
setup and classloader url section are from my plugin: 

...
[DEBUG] Configuring mojo 'dhc.maven:junit4x:0.0.1:runJunit4Tests' -->
[DEBUG]   (f) classDir =
C:\Projects\reallayout\target\generated-classes\cobertura
[DEBUG]   (f) dependencies = [junit:junit:jar:4.1:test,
commons-logging:commons-logging:jar:1.0.4:compile,
cobertura:cobertura-runtime:pom:1.8:test]
[DEBUG]   (f) failOnTestFailure = true
[DEBUG]   (f) reportDir = C:\Projects\reallayout\target\junit
[DEBUG]   (f) resultsProcessorClass =
dhc.maven2.junit4x.results.HtmlGenerator
[DEBUG]   (f) testClassDir = C:\Projects\reallayout\target\test-classes
[DEBUG] -- end configuration --
[INFO] junit4x:runJunit4Tests {execution: default}
[DEBUG] Plugin Setup
[DEBUG] =========================================
[DEBUG] Compiled classes directory     :
C:\Projects\reallayout\target\generated-classes\cobertura
[DEBUG] Compiled test classes directory:
C:\Projects\reallayout\target\test-classes
[DEBUG] Output report directory        : C:\Projects\reallayout\target\junit
[DEBUG] Fail build if tests fail       : true
[DEBUG] Results processor class        :
dhc.maven2.junit4x.results.HtmlGenerator
[DEBUG] Adding to unit test classpath  : C:\Documents and
Settings\clarksonde\.m2\repository\junit\junit\4.1\junit-4.1.jar
[DEBUG] Adding to unit test classpath  : C:\Documents and
Settings\clarksonde\.m2\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar
[DEBUG] Adding to unit test classpath  : C:\Documents and
Settings\clarksonde\.m2\repository\cobertura\cobertura-runtime\1.8\cobertura-runtime-1.8.pom
[DEBUG] =========================================
[DEBUG] Classloader url =
file:/C:/Projects/reallayout/target/generated-classes/cobertura/
[DEBUG] Classloader url = file:/C:/Projects/reallayout/target/test-classes/
[DEBUG] Classloader url =
file:/C:/Documents%20and%20Settings/clarksonde/.m2/repository/junit/junit/4.1/junit-4.1.jar
[DEBUG] Classloader url =
file:/C:/Documents%20and%20Settings/clarksonde/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
[DEBUG] Classloader url =
file:/C:/Documents%20and%20Settings/clarksonde/.m2/repository/cobertura/cobertura-runtime/1.8/cobertura-runtime-1.8.pom
...

I am using a standard URLClassloader as I have seen other plugins use. 

This has got me really confused. All I can think of is that the
instrumenting of the code is causing the class loader to see the class as
something else and therefore not finding it. Does anyone have any ideas ?

ciao
Derek

-- 
View this message in context: http://www.nabble.com/Custom-class-loader-issue-and-cobertura-plugin-tf3158007s177.html#a8758523
Sent from the Maven Developers mailing list archive at Nabble.com.


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