Author: aheritier
Date: Wed Jan 30 16:04:15 2008
New Revision: 616964

URL: http://svn.apache.org/viewvc?rev=616964&view=rev
Log:
FIXED - issue MECLIPSE-367: Dependency to artifact with classifier tests not 
distinguished from the regular artifact 
http://jira.codehaus.org/browse/MECLIPSE-367
tests projects 07 and 33 are fixed.

Modified:
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
    
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/expected/.classpath
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/pom.xml
    
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-33/pom.xml

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
 Wed Jan 30 16:04:15 2008
@@ -340,12 +340,12 @@
             String version =
                 getValue( pom, ReadWorkspaceLocations.VERSION, getValue( pom, 
ReadWorkspaceLocations.PARENT_VERSION,
                                                                          null 
) );
-            String packageing = getValue( pom, 
ReadWorkspaceLocations.PACKAGING, "jar" );
+            String packaging = getValue( pom, 
ReadWorkspaceLocations.PACKAGING, "jar" );
 
-            logger.debug( "found workspace artefact " + group + ":" + artifact 
+ ":" + version + " " + packageing +
+            logger.debug( "found workspace artefact " + group + ":" + artifact 
+ ":" + version + " " + packaging +
                 " (" + eclipseProjectName + ")" + " -> " + projectLocation );
-            return new IdeDependency( group, artifact, version, packageing, 
true, false, false, false, false, null,
-                                      packageing, false, null, 0, 
eclipseProjectName );
+            return new IdeDependency( group, artifact, version, packaging, 
true, false, false, false, false, null,
+                                      packaging, false, null, 0, 
eclipseProjectName );
         }
         else
         {

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
 Wed Jan 30 16:04:15 2008
@@ -228,7 +228,7 @@
      */
     public ArtifactMetadataSource getArtifactMetadataSource()
     {
-        return this.artifactMetadataSource;
+        return artifactMetadataSource;
     }
 
     /**
@@ -248,7 +248,7 @@
      */
     public MavenProject getProject()
     {
-        return this.project;
+        return project;
     }
 
     /**
@@ -268,7 +268,7 @@
      */
     public List getReactorProjects()
     {
-        return this.reactorProjects;
+        return reactorProjects;
     }
 
     /**
@@ -288,7 +288,7 @@
      */
     public List getRemoteArtifactRepositories()
     {
-        return this.remoteArtifactRepositories;
+        return remoteArtifactRepositories;
     }
 
     /**
@@ -308,7 +308,7 @@
      */
     public ArtifactFactory getArtifactFactory()
     {
-        return this.artifactFactory;
+        return artifactFactory;
     }
 
     /**
@@ -328,7 +328,7 @@
      */
     public ArtifactResolver getArtifactResolver()
     {
-        return this.artifactResolver;
+        return artifactResolver;
     }
 
     /**
@@ -348,7 +348,7 @@
      */
     public MavenProject getExecutedProject()
     {
-        return this.executedProject;
+        return executedProject;
     }
 
     /**
@@ -368,7 +368,7 @@
      */
     public ArtifactRepository getLocalRepository()
     {
-        return this.localRepository;
+        return localRepository;
     }
 
     /**
@@ -388,7 +388,7 @@
      */
     public boolean getDownloadJavadocs()
     {
-        return this.downloadJavadocs;
+        return downloadJavadocs;
     }
 
     /**
@@ -398,7 +398,7 @@
      */
     public void setDownloadJavadocs( boolean downloadJavadoc )
     {
-        this.downloadJavadocs = downloadJavadoc;
+        downloadJavadocs = downloadJavadoc;
     }
 
     /**
@@ -408,7 +408,7 @@
      */
     public boolean getDownloadSources()
     {
-        return this.downloadSources;
+        return downloadSources;
     }
 
     /**
@@ -755,7 +755,7 @@
             String type = dependency.getType();
             if ( type == null )
             {
-                type = Constants.PROJECT_PACKAGING_JAR; //$NON-NLS-1$
+                type = Constants.PROJECT_PACKAGING_JAR;
             }
             String classifier = dependency.getClassifier();
             boolean optional = dependency.isOptional();
@@ -1034,17 +1034,15 @@
                                 "Searching for sources for " + 
dependency.getId() + ":" + dependency.getClassifier() +
                                     " at " + dependency.getId() + ":" + 
classifier );
             }
-
             if ( !unavailableArtifactsCache.containsKey( dependency.getId() + 
":" + classifier ) )
             {
                 Artifact artifact =
                     IdeUtils.resolveArtifactWithClassifier( 
dependency.getGroupId(), dependency.getArtifactId(),
                                                             
dependency.getVersion(), classifier, localRepository,
-                                                            artifactResolver, 
//$NON-NLS-1$
-                                                            artifactFactory, 
remoteRepos, getLog() );
+                                                            artifactResolver, 
artifactFactory, remoteRepos, getLog() );
                 if ( artifact.isResolved() )
                 {
-                    if ( "sources".equals( classifier ) )
+                    if ( "sources".equals( classifier ) || 
"test-sources".equals( classifier ) )
                     {
                         dependency.setSourceAttachment( artifact.getFile() );
                     }
@@ -1114,6 +1112,6 @@
             }
             msg.append( "\n" ); //$NON-NLS-1$
         }
-        getLog().info( msg ); //$NON-NLS-1$
+        getLog().info( msg );
     }
 }

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
 Wed Jan 30 16:04:15 2008
@@ -161,7 +161,7 @@
      */
     public File getJavadocAttachment()
     {
-        return this.javadocAttachment;
+        return javadocAttachment;
     }
 
     /**
@@ -181,7 +181,7 @@
      */
     public String getArtifactId()
     {
-        return this.artifactId;
+        return artifactId;
     }
 
     /**
@@ -201,7 +201,7 @@
      */
     public String getGroupId()
     {
-        return this.groupId;
+        return groupId;
     }
 
     /**
@@ -221,7 +221,7 @@
      */
     public String getVersion()
     {
-        return this.version;
+        return version;
     }
 
     /**
@@ -241,7 +241,7 @@
      */
     public String getClassifier()
     {
-        return this.classifier;
+        return classifier;
     }
 
     /**
@@ -261,7 +261,7 @@
      */
     public boolean isReferencedProject()
     {
-        return this.referencedProject;
+        return referencedProject;
     }
 
     /**
@@ -271,7 +271,7 @@
      */
     public boolean isOsgiBundle()
     {
-        return this.osgiBundle;
+        return osgiBundle;
     }
 
     /**
@@ -291,7 +291,7 @@
      */
     public File getSourceAttachment()
     {
-        return this.sourceAttachment;
+        return sourceAttachment;
     }
 
     /**
@@ -311,7 +311,7 @@
      */
     public boolean isSystemScoped()
     {
-        return this.systemScoped;
+        return systemScoped;
     }
 
     /**
@@ -331,7 +331,7 @@
      */
     public boolean isTestDependency()
     {
-        return this.testDependency;
+        return testDependency;
     }
 
     /**
@@ -351,7 +351,7 @@
      */
     public File getFile()
     {
-        return this.file;
+        return file;
     }
 
     /**
@@ -371,7 +371,7 @@
      */
     public String getId()
     {
-        return this.groupId + ':' + this.artifactId + ':' + this.version;
+        return groupId + ':' + artifactId + ':' + version;
     }
 
     /**
@@ -381,7 +381,7 @@
      */
     public String getType()
     {
-        return this.type;
+        return type;
     }
 
     /**
@@ -401,7 +401,7 @@
      */
     public boolean isAddedToClasspath()
     {
-        return this.addedToClasspath;
+        return addedToClasspath;
     }
 
     /**
@@ -421,7 +421,7 @@
      */
     public boolean isProvided()
     {
-        return this.provided;
+        return provided;
     }
 
     /**
@@ -441,7 +441,7 @@
      */
     public String getEclipseProjectName()
     {
-        return this.eclipseProjectName;
+        return eclipseProjectName;
     }
 
     /**
@@ -463,7 +463,7 @@
     }
 
     /**
-     * @see java.lang.Comparable#compareTo(java.lang.Object) Compare using 
groupId+artifactId+type Strings
+     * @see java.lang.Comparable#compareTo(java.lang.Object) Compare using 
groupId+artifactId+type+classifier Strings
      */
     public int compareTo( Object o )
     {
@@ -488,6 +488,22 @@
         {
             return equals;
         }
+        if ( this.getClassifier() != null && dep.getClassifier() != null )
+        {
+            equals = this.getClassifier().compareTo( dep.getClassifier() );
+        }
+        else if ( this.getClassifier() != null && dep.getClassifier() == null )
+        {
+            return 1;
+        }
+        else if ( this.getClassifier() == null && dep.getClassifier() != null )
+        {
+            return -1;
+        }
+        if ( equals != 0 )
+        {
+            return equals;
+        }
         return 0;
     }
 
@@ -526,7 +542,16 @@
         }
         else
         {
-            return this.getGroupId().hashCode() ^ 
this.getArtifactId().hashCode() ^ this.getType().hashCode();
+            int hashCode = this.getGroupId().hashCode() ^ 
this.getArtifactId().hashCode() ^ this.getType().hashCode();
+            if ( this.getClassifier() == null )
+            {
+                return hashCode;
+            }
+            else
+            {
+                return hashCode ^ this.getClassifier().hashCode();
+            }
+
         }
     }
 }

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
 Wed Jan 30 16:04:15 2008
@@ -88,7 +88,7 @@
         throws Exception
     {
         // Fails because of MECLIPSE-367
-        // testProject( "project-07" );
+        testProject( "project-07" );
     }
 
     public void testProject08()
@@ -366,15 +366,15 @@
     }
 
     /**
-     * MECLIPSE-287 : dependencies with and without classifiers MECLIPSE-151 : 
test jar source attachments
+     * MECLIPSE-287 : dependencies with and without classifiers. MECLIPSE-151 
: test jar source attachments.
+     * MECLIPSE-367 : Dependency to artifact with classifier tests not 
distinguished from the regular artifact
      * 
      * @throws Exception any exception thrown during test
      */
     public void testProject33()
         throws Exception
     {
-        // Fails because of MECLIPSE-367
-        // testProject( "project-33" );
+        testProject( "project-33" );
     }
 
     public void testProject34()

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/expected/.classpath
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/expected/.classpath?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/expected/.classpath
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/expected/.classpath
 Wed Jan 30 16:04:15 2008
@@ -1,6 +1,6 @@
 <classpath>
   <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" 
path="M2_REPO/maven/maven-core/98.0/maven-core-98.0-tests.jar" 
sourcepath="M2_REPO/maven/maven-core/98.0/maven-core-98.0-sources.jar"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" 
path="M2_REPO/maven/maven-core/98.0/maven-core-98.0-tests.jar" 
sourcepath="M2_REPO/maven/maven-core/98.0/maven-core-98.0-test-sources.jar"/>
   <classpathentry kind="var" 
path="M2_REPO/maven/maven-core/98.0/maven-core-98.0.jar" 
sourcepath="M2_REPO/maven/maven-core/98.0/maven-core-98.0-sources.jar"/>
 </classpath>

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/pom.xml?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/pom.xml
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-07/pom.xml
 Wed Jan 30 16:04:15 2008
@@ -28,6 +28,7 @@
         <artifactId>maven-eclipse-plugin</artifactId>
         <version>test</version>
         <configuration>
+          <downloadSources>true</downloadSources>
           <wtpversion>R7</wtpversion>
           <projectnatures>
             <projectnature>org.eclipse.jdt.core.javanature</projectnature>

Modified: 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-33/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-33/pom.xml?rev=616964&r1=616963&r2=616964&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-33/pom.xml
 (original)
+++ 
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-33/pom.xml
 Wed Jan 30 16:04:15 2008
@@ -20,4 +20,16 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <version>test</version>
+        <configuration>
+          <downloadSources>true</downloadSources>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 </project>


Reply via email to