You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2007/07/04 04:55:17 UTC

svn commit: r553048 - in /maven/plugins/branches/maven-eclipse-plugin-151-287/src: main/java/org/apache/maven/plugin/ide/ test/java/org/apache/maven/plugin/eclipse/ test/resources/m2repo/maven/maven-core/98.0/ test/resources/projects/project-33/ test/r...

Author: brianf
Date: Tue Jul  3 19:55:16 2007
New Revision: 553048

URL: http://svn.apache.org/viewvc?view=rev&rev=553048
Log:
parking MECLIPSE-151 and MECLIPSE-287

Added:
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/m2repo/maven/maven-core/98.0/maven-core-98.0-tests-sources.jar
      - copied unchanged from r552634, maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/m2repo/maven/maven-core/98.0/maven-core-98.0-tests.jar
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.classpath
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.project
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/pom.xml
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.classpath
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.project
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/pom.xml
Modified:
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
    maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java

Modified: maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?view=diff&rev=553048&r1=553047&r2=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java (original)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java Tue Jul  3 19:55:16 2007
@@ -587,13 +587,14 @@
 
                             isOsgiBundle = osgiSymbolicName != null;
 
-                            IdeDependency dep = new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
-                                                                   isReactorProject, Artifact.SCOPE_TEST.equals( art
-                                                                       .getScope() ), Artifact.SCOPE_SYSTEM.equals( art
-                                                                       .getScope() ), Artifact.SCOPE_PROVIDED.equals( art
-                                                                       .getScope() ), art.getArtifactHandler()
-                                                                       .isAddedToClasspath(), art.getFile(), art.getType(),
-                                                                   isOsgiBundle, osgiSymbolicName, dependencyDepth );
+                        IdeDependency dep = new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
+                                                               art.getClassifier(),
+                                                               isReactorProject, Artifact.SCOPE_TEST.equals( art
+                                                                   .getScope() ), Artifact.SCOPE_SYSTEM.equals( art
+                                                                   .getScope() ), Artifact.SCOPE_PROVIDED.equals( art
+                                                                   .getScope() ), art.getArtifactHandler()
+                                                                   .isAddedToClasspath(), art.getFile(), art.getType(),
+                                                               isOsgiBundle, osgiSymbolicName, dependencyDepth );
 
                             dependencies.add( dep );
                         }
@@ -832,11 +833,21 @@
                 continue;
             }
 
-            if ( !unavailableSourcesCache.containsKey( dependency.getId() + ":sources" ) )
+            String classifier = "sources";
+            if("tests".equals(dependency.getClassifier()))
+            {
+                classifier = "test-sources";
+            }
+            if(getLog().isDebugEnabled())
+            {
+                getLog().debug("Searching for sources for "+dependency.getId()+":"+dependency.getClassifier()+" at "+dependency.getId() + ":" + classifier);
+            }
+            
+            if ( !unavailableSourcesCache.containsKey( dependency.getId() + ":" + classifier ) )
             {
                 // source artifact: use the "sources" classifier added by the source plugin
                 Artifact sourceArtifact = IdeUtils.resolveArtifactWithClassifier( dependency.getGroupId(), dependency
-                    .getArtifactId(), dependency.getVersion(), "sources", localRepository, artifactResolver, //$NON-NLS-1$
+                    .getArtifactId(), dependency.getVersion(), classifier, localRepository, artifactResolver, //$NON-NLS-1$
                                                                                   artifactFactory, remoteRepos,
                                                                                   getLog() );
                 if ( sourceArtifact.isResolved() )
@@ -845,7 +856,7 @@
                 }
                 else
                 {
-                    unavailableSourcesCache.put( dependency.getId() + ":sources", Boolean.TRUE.toString() );
+                    unavailableSourcesCache.put( dependency.getId() + ":" + classifier, Boolean.TRUE.toString() );
                     // @todo also report deps without a source attachment but with a javadoc one?
                     missingSourceDependencies.add( dependency );
                 }

Modified: maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java?view=diff&rev=553048&r1=553047&r2=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java (original)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java Tue Jul  3 19:55:16 2007
@@ -83,6 +83,11 @@
     private String version;
 
     /**
+     * Artifact classifier
+     */
+    private String classifier;
+    
+    /**
      * Artifact type.
      */
     private String type;
@@ -104,6 +109,7 @@
      * @param groupId Group id
      * @param artifactId Artifact id
      * @param version Artifact version
+     * @param classifier Artifact classifier
      * @param referencedProject Is this dependency available in the reactor?
      * @param testDependency Is this a test dependency?
      * @param systemScoped Is this a system scope dependency?
@@ -115,7 +121,7 @@
      * @param osgiSymbolicName Bundle-SymbolicName from the Manifest (if available)
      * @param dependencyDepth Depth of this dependency in the transitive dependency trail.
      */
-    public IdeDependency( String groupId, String artifactId, String version, boolean referencedProject,
+    public IdeDependency( String groupId, String artifactId, String version, String classifier, boolean referencedProject,
                           boolean testDependency, boolean systemScoped, boolean provided, boolean addedToClasspath,
                           File file, String type, boolean osgiBundle, String osgiSymbolicName, int dependencyDepth )
     {
@@ -123,6 +129,7 @@
         this.groupId = groupId;
         this.artifactId = artifactId;
         this.version = version;
+        this.classifier = classifier;
 
         // flags
         this.referencedProject = referencedProject;
@@ -210,6 +217,24 @@
         this.version = version;
     }
 
+    /**
+     * Getter for <code>classifier</code>.
+     * @return Returns the classifier.
+     */
+    public String getClassifier()
+    {
+        return this.classifier;
+    }
+
+    /**
+     * Setter for <code>groupId</code>.
+     * @param groupId The groupId to set.
+     */
+    public void setClassifier( String classifier )
+    {
+        this.classifier = classifier;
+    }
+    
     /**
      * Getter for <code>referencedProject</code>.
      * @return Returns the referencedProject.

Modified: maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java?view=diff&rev=553048&r1=553047&r2=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java (original)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java Tue Jul  3 19:55:16 2007
@@ -221,7 +221,7 @@
         String type = classifier;
 
         // the "sources" classifier maps to the "java-source" type
-        if ( "sources".equals( type ) ) //$NON-NLS-1$
+        if ( "sources".equals( type ) || "test-sources".equals( type ) ) //$NON-NLS-1$
         {
             type = "java-source"; //$NON-NLS-1$
         }

Modified: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?view=diff&rev=553048&r1=553047&r2=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java (original)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java Tue Jul  3 19:55:16 2007
@@ -336,4 +336,24 @@
     {
         testProject( "project-32" );
     }
+    
+    /**
+     * Checks that the test-sources jar gets the right name.
+     * @throws Exception any exception thrown during test
+     */
+     public void testProject35() throws Exception
+        {
+            testProject( "project-35" );
+        }
+    /**
+     * MECLIPSE-287 : dependencies with and without classifiers
+     * MECLIPSE-151 : test jar source attachments
+     * 
+     * @throws Exception
+     *             any exception thrown during test
+     */
+    public void testProject33() throws Exception
+    {
+        testProject( "project-33" );
+    }
 }

Added: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.classpath?view=auto&rev=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.classpath (added)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.classpath Tue Jul  3 19:55:16 2007
@@ -0,0 +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-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>

Added: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.project
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.project?view=auto&rev=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.project (added)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/expected/.project Tue Jul  3 19:55:16 2007
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-33</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>

Added: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/pom.xml?view=auto&rev=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/pom.xml (added)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-33/pom.xml Tue Jul  3 19:55:16 2007
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>eclipse</groupId>
+  <artifactId>maven-eclipse-plugin-test-project-MECLIPSE-287</artifactId>
+  <version>MECLIPSE-287</version>
+  <packaging>jar</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>98.0</version>
+    </dependency>
+    <dependency>
+      <groupId>maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>98.0</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.classpath?view=auto&rev=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.classpath (added)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.classpath Tue Jul  3 19:55:16 2007
@@ -0,0 +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-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>
\ No newline at end of file

Added: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.project
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.project?view=auto&rev=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.project (added)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/expected/.project Tue Jul  3 19:55:16 2007
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>maven-eclipse-plugin-test-project-35</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>

Added: maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/pom.xml?view=auto&rev=553048
==============================================================================
--- maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/pom.xml (added)
+++ maven/plugins/branches/maven-eclipse-plugin-151-287/src/test/resources/projects/project-35/pom.xml Tue Jul  3 19:55:16 2007
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+  http://maven.apache.org/maven-v4_0_0.xsd">
+  <!-- project35 is a very simple project which just shows up a problem
+  with the name of the test-sources jar -->
+  <modelVersion>4.0.0</modelVersion>
+  <packaging>jar</packaging>
+  <groupId>eclipse</groupId>
+  <artifactId>maven-eclipse-plugin-test-project-35</artifactId>
+  <version>99.0</version>
+  <name>Maven</name>
+  <dependencies>
+    <dependency>
+      <groupId>maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <version>98.0</version>
+    </dependency>
+    <dependency>
+      <groupId>maven</groupId>
+      <artifactId>maven-core</artifactId>
+      <classifier>tests</classifier>
+      <version>98.0</version>
+    </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>
\ No newline at end of file