Maven 2.1plugin cannot use classes form tools.jar
-------------------------------------------------

                 Key: MNG-3715
                 URL: http://jira.codehaus.org/browse/MNG-3715
             Project: Maven 2
          Issue Type: Bug
          Components: General
    Affects Versions: 2.1.0, 2.1.x
         Environment: Maven 2.1 Snapshot
            Reporter: Yann Albou
         Attachments: caseMaven.zip

If a Maven plugin uses classes from ${java.home}/lib/tools.jar
for instance : com.sun.mirror.apt.AnnotationProcessorFactory

and if a Maven 2.1 project use this plugin then the following error appends:

{code}
java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory
        at org.test.simplePlugin.MyMojo.execute(MyMojo.java:33)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:638)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:521)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:288)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:214)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:172)
        at 
org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
        at 
org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:303)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
        at 
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
        at 
org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:303)
        at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:176)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:408)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:351)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:31)
{code}

I typically get this error with the maven-jaxb-schemagen-plugin but I created 
also a simple test case.

Of course the tools.jar dependency is used:
{code:xml}
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.5</version>
          <scope>system</scope>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>
{code}

I tested with the last Maven 2.1 SNAPSHOT distribution.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to