Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
2.8
-
None
-
None
-
Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
Java version: 1.5.0_16
-
Patch
Description
Scenario:
1) Check out a library into your workspace, in SNAPSHOT mode. e.g. the version is 2.0-SNAPSHOT.
2) This project is being built by a CI server, using the standard snapshot artifact naming convention. e.g. 2.0-20100513.210009-65
3) In project in workspace that uses the library, when you run eclipse:eclipse, in the .classpath file it will link to the jar in the .m2/repository location. In the log you'll see a message like:
[INFO] Artifact com.example:MyLibrary:jar:2.0-SNAPSHOT already available as a workspace project, but with different version. Expected: 2.0-20100513.210009-65, found: 2.0-SNAPSHOT
The weird issues:
W1) The difficult part is that if in the library you run a "mvn install" command first, and then in the other project run "mvn eclipse:eclipse", it will correctly depend on your project in the workspace.
W2) After doing W1, if the next day you re-run "mvn eclipse:eclipse" in the non-library project, it will then resolve to the artifact built in the CI server and no longer link the project to the library in the workspace.
The workaround:
Each day run "mvn install" in the library before running "mvn eclipse:eclipse" in the other project.
The solution (no patch yet, can't make it through the firewall at work):
Instead of using org.apache.maven.artifact.Artifact#getVersion(), getBaseVersion() should be used instead.
In the AbstractIdeSupportMojo#doDependencyResolution() method, near the bottom where it passing in the version, it should use the getBaseVersion()
http://maven.apache.org/plugins/maven-eclipse-plugin/xref/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.html#685
In the EclipsePlugin#isAvailableAsAWorkspaceProject( Artifact artifact ) method, it should compare the "version" in the workspace to the "baseVersion"
http://maven.apache.org/plugins/maven-eclipse-plugin/xref/org/apache/maven/plugin/eclipse/EclipsePlugin.html#1941