I would like to ask what is the right away to pass the classpath to emma when you run emma via jvmarg.
I run emma via jvmarg in the xml file for Ant-Junit . I noticed emma ignored the classpath that was defined by me in Junit, but strictly used ${env.CLASSPATH} which in turn caused NoClassFoundException, since a few test classes required some jar files in the defined classpath and those jars were not in ${env.CLASSPATH}.
<jvmarg value="-Xbootclasspath/a:${emma.jar}/emma.jar"/>
<jvmarg value="emmarun"/>
<jvmarg value="-out"/>
<jvmarg value="${emma.out}"/>
…
… (a few other jvmargs)
</junit>
Each test class did not get ${junit.classpath} as a classpath but got ${env.CLASSPATH}. Again, a few test classes threw NoClassFoundException since it needed jars in ${junit.classpath}.
I also tried adding this line:
<jvmarg value="-classpath"/>
<jvmarg value="${junit.classpath"/> (and also <jvmarg pathref="junit.classpath"/>)
along with other jvmargs and the issue persisted.
Lastly, when I 'hacked' env.CLASSPATH by adding this line to Junit:
<env key="CLASSPATH" value="${env.CLASSPATH}:${junit.classpath}"/> without loading the ${junit.classpath} via <classpath refid="junit.classpath"/>, and also without <jvmarg value="-classpath….>, each test class got the jars in ${junit.classpath}. But, I wouldn't consider that's the right way to use emma.
Any help is appreciated. Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a chance to play around it a little bit more and I was able to resolve the issue by avoiding to use -Xbootclasspath, and providing the classpath as a part of jvmarg normally. That is,
<jvmarg value="-cp" />
<jvmarg value="${emma.jar}/emma.jar"/>
<jvmarg value="emmarun"/>
<jvmarg value="-out"/>
<jvmarg value="${emma.out}"/>
<jvmarg value="-cp" />
<jvmarg pathref="junit.classpath"/>
… (and a few more jvm args) …
then, each test class got all the jars and directories in ${junit.classpath}. The first -cp was emma itself so that we were able to run emmarun, and the second -cp was rather a part of the command-line argument of EMMA that allowed us to pass the application's classpath.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I would like to ask what is the right away to pass the classpath to emma when you run emma via jvmarg.
I run emma via jvmarg in the xml file for Ant-Junit . I noticed emma ignored the classpath that was defined by me in Junit, but strictly used ${env.CLASSPATH} which in turn caused NoClassFoundException, since a few test classes required some jar files in the defined classpath and those jars were not in ${env.CLASSPATH}.
I have this Junit target:
<junit fork="true" forkmode="once" printsummary="yes" haltonfailure="no">
<classpath refid="${junit.classpath}" />
<batchtest todir="${junit.toDir}">
<fileset dir=…>
…
</fileset>
</batchtest>
<formatter type="xml" />
<jvmarg value="-Xbootclasspath/a:${emma.jar}/emma.jar"/>
<jvmarg value="emmarun"/>
<jvmarg value="-out"/>
<jvmarg value="${emma.out}"/>
…
… (a few other jvmargs)
</junit>
Each test class did not get ${junit.classpath} as a classpath but got ${env.CLASSPATH}. Again, a few test classes threw NoClassFoundException since it needed jars in ${junit.classpath}.
I also tried adding this line:
<jvmarg value="-classpath"/>
<jvmarg value="${junit.classpath"/> (and also <jvmarg pathref="junit.classpath"/>)
along with other jvmargs and the issue persisted.
Lastly, when I 'hacked' env.CLASSPATH by adding this line to Junit:
<env key="CLASSPATH" value="${env.CLASSPATH}:${junit.classpath}"/> without loading the ${junit.classpath} via <classpath refid="junit.classpath"/>, and also without <jvmarg value="-classpath….>, each test class got the jars in ${junit.classpath}. But, I wouldn't consider that's the right way to use emma.
Any help is appreciated. Thanks.
I had a chance to play around it a little bit more and I was able to resolve the issue by avoiding to use -Xbootclasspath, and providing the classpath as a part of jvmarg normally. That is,
<jvmarg value="-cp" />
<jvmarg value="${emma.jar}/emma.jar"/>
<jvmarg value="emmarun"/>
<jvmarg value="-out"/>
<jvmarg value="${emma.out}"/>
<jvmarg value="-cp" />
<jvmarg pathref="junit.classpath"/>
… (and a few more jvm args) …
then, each test class got all the jars and directories in ${junit.classpath}. The first -cp was emma itself so that we were able to run emmarun, and the second -cp was rather a part of the command-line argument of EMMA that allowed us to pass the application's classpath.