Plugins artifact filtering should use full Artifact identification instead only
ArtifactId
------------------------------------------------------------------------------------------
Key: MNG-4553
URL: http://jira.codehaus.org/browse/MNG-4553
Project: Maven 2 & 3
Issue Type: Bug
Components: Plugins and Lifecycle
Affects Versions: 2.2.1
Environment: Windows7, Sun JDK 1.6.0_u18
Reporter: Kek
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.
--
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