Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.1
-
None
-
Windows7, Sun JDK 1.6.0_u18
Description
I created common module with some abstract parents and Helpers for our Mojos. I named the module as "maven-plugin-api", but the groupId was "org.mycompany.maven". Than I create "my-maven-plugin" that depends on this common library "org.mycompany.maven:maven-plugin-api". When I try to use the MyMavenPlugin, I get the following message:
[DEBUG] The following artifacts were filtered out for plugin: org.mycompany.maven:my-maven-plugin:1.0.0-SNAPSHOT because they're already in the core of Maven:
active project artifact:
artifact = org.mycompany.maven:maven-plugin-api:jar:1.0.0-SNAPSHOT:runtime;
project: MavenProject: org.mycompany.maven:maven-plugin-api:1.0.0-SNAPSHOT
These will use the artifact files already in the core ClassRealm instead, to allow them to be included in PluginDescriptor.getArtifacts().
And than build fails with
Caused by: java.lang.ClassNotFoundException: org.mycompany.maven.mojo.AbstractProjectMojo
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 52 more
After some investigation I found the workaround for this problem - I must rename the shared module "org.mycompany.maven:maven-plugin-api" to ""org.mycompany.maven:MY-maven-plugin-api" so I can not use the artifactId like "maven-plugin-api" because it is already used for core maven modules and therefore my library was filtered out.
But this is not correct behaviour, because the artifactId was the same, but the groupId was different. In my opinion the maven should use the full-id during the Artifact comparation and filtering.
Attachments
Issue Links
- relates to
-
MNG-4666 [regression] Plugins depending on plexus:plexus-container-default get broken runtime classpath
- Closed