You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ståle pedersen <st...@gmail.com> on 2008/02/05 10:34:47 UTC

maven classpath help

hi, im trying to add loadtime weaving with jboss aop to my unit tests.
to achieve this i need to add the jvm option:
-javaagent:/path/to/jboss-aop.jar, and a option to specify where the
xml file that contains the pointcuts etc is.

the problem ive had is that the jboss-aop.jar depends on a few other jars and
when SurefireBooter starts a new jvm it do not add these to the
classpath. just a few surefire jars are added afaik.
here is the output when i run in debug mode:

Forking command line: java
-javaagent:/home/stalep/.m2/repository/org/jboss/aop/jboss-aop/2.0.0.CR3/jboss-aop-2.0.0.CR3.jar
-Djboss.aop.path=src/test/conf/jboss-aop.xml -classpath
/home/stalep/.m2/repository/org/apache/maven/surefire/surefire-api/2.0/surefire-api-2.0.jar:/home/stalep/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar:/home/stalep/.m2/repository/org/apache/maven/surefire/surefire-booter/2.0/surefire-booter-2.0.jar
org.apache.maven.surefire.booter.SurefireBooter /tmp/surefire12863tmp
/tmp/surefire12864tmp
Exception in thread "main" java.lang.NoClassDefFoundError:
javassist/scopedpool/ScopedClassPoolFactory
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
        at java.lang.Class.getMethod0(Class.java:2642)
FATAL ERROR in native method: processing of -javaagent failed

here is the surefire-plugin options ive set:
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <forkMode>always</forkMode>
    <useSystemClassLoader>true</useSystemClassLoader>
    <argLine>-javaagent:/home/stalep/.m2/repository/org/jboss/aop/jboss-aop/2.0.0.CR3/jboss-aop-2.0.0.CR3.jar
-Djboss.aop.path=src/test/conf/jboss-aop.xml</argLine>
  </configuration>
</plugin>

from what ive seen in the source (just looked a bit at
SurefireBooter.java and SurefirePlugin.java) it seems that setting
useSystemClassLoader=true should add all the dependent jars to the
classpath when the jvm starts.
SurefireBooter.java, fork():
[snip]
bootClasspath.addAll( surefireBootClassPathUrls );
if ( useSystemClassLoader() )
{
  bootClasspath.addAll( classPathUrls );
}

Commandline cli = forkConfiguration.createCommandLine( bootClasspath,
useSystemClassLoader() );
[/snip]

ive set this option in the plugin configuration, but it do not add the
other jars to the bootClassPath.
is there something ive missed? any tip/info is highly appreciated

ståle

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