From: Elliotte H. <el...@me...> - 2005-09-18 08:48:17
|
I'm trying to get the Maven plugin for Cobertura to work. Cobertura instruments code to measure coverage of the test suite. To do this it recompiles the code base into a different directory from the usual build directory. I then need to run the test suite (<attainGoal name="test:test"/>) using this instrumented directory rather than the usual build directory. Using verbose output from Maven it's apparent that the tests are running with the original code rather than the instrumented code: [junit] [DEBUG] Execute:Java13CommandLauncher: Executing '/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home/bin/java' with arguments: '-Dbasedir=/Users/elharo/Projects/Jaxen' '-classpath' '/Users/elharo/Projects/Jaxen/target/test-classes:/Users/elharo/Projects/Jaxen/target/classes:/Users/elharo/.maven/repository/dom4j/jars/dom4j-1.6.1.jar:/Users/elharo/.maven/repository/jdom/jars/jdom-1.0.jar:/Users/elharo/.maven/repository/xerces/jars/xmlParserAPIs-2.6.2.jar:/Users/elharo/.maven/repository/xerces/jars/xercesImpl-2.6.2.jar:/Users/elharo/.maven/repository/xom/jars/xom-1.0b3.jar:/Users/elharo/.maven/repository/urbanophile/jars/java-getopt-1.0.9.jar:/Users/elharo/.maven/repository/javancss/jars/javancss-21.41.jar:/Users/elharo/.maven/repository/javancss/jars/ccl-21.41.jar:/Users/elharo/.maven/repository/asm/jars/asm-2.0.jar:/Users/elharo/.maven/repository/oro/jars/oro-2.0.8.jar:/Users/elharo/.maven/repository/log4j/jars/log4j-1.2.8.jar:/Users/elharo/.maven/repository/cobertura/jars/cobertura-1.6.jar:/Users/elharo/.maven/repository/junit/jars/junit-3.8.1.jar:/Users/elharo/.maven/repository/xml-apis/jars/xml-apis-1.0.b2.jar:/Users/elharo/.maven/repository/xerces/ja rs/xerces-2.4.0.jar:/opt/maven-1.0.2/lib/ant-1.5.3-1.jar:/opt/maven-1.0.2/lib/ant-optional-1.5.3-1.jar' 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner' Instead of /Users/elharo/Projects/Jaxen/target/classes that should be /Users/elharo/Projects/Jaxen/target/cobertura/classes What I'm not sure of is how to change the Cobertura plugin.jelly file to use a different directory for the test classpath. Currently we have this: <attainGoal name="cobertura:on"/> <attainGoal name="test:test"/> The cobertura:on goal does set the following variables: <maven:set plugin="maven-java-plugin" property="maven.build.dest" value="${instrumented}"/> <maven:set plugin="maven-test-plugin" property="maven.build.dest" value="${instrumented}"/> $instrumented is the directory where the instrumented classes live) and I've verified via log:info that these variables do get changed. However, this doesn't seem to affect the classpath for the JUnit test runner. Any ideas? -- Elliotte Rusty Harold el...@me... XML in a Nutshell 3rd Edition Just Published! http://www.cafeconleche.org/books/xian3/ http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim |