You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2006/03/07 07:42:03 UTC

svn commit: r383800 - /maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java

Author: epunzalan
Date: Mon Mar  6 22:42:02 2006
New Revision: 383800

URL: http://svn.apache.org/viewcvs?rev=383800&view=rev
Log:
PR: MIDEA-31

Fixed bug that fails on dependencies with classifiers

Modified:
    maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java?rev=383800&r1=383799&r2=383800&view=diff
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/AbstractIdeaMojo.java Mon Mar  6 22:42:02 2006
@@ -274,15 +274,25 @@
         {
             Dependency dep = (Dependency) dependencies.next();
 
-            if ( dep.getScope() == null )
+            String groupId = dep.getGroupId();
+            String artifactId = dep.getArtifactId();
+            VersionRange versionRange = VersionRange.createFromVersion( dep.getVersion() );
+            String type = dep.getType();
+            if ( type == null )
             {
-                dep.setScope( Artifact.SCOPE_COMPILE );
+                type = "jar";
+            }
+            String classifier = dep.getClassifier();
+            boolean optional = dep.isOptional();
+            String scope = dep.getScope();
+            if ( scope == null )
+            {
+                scope = Artifact.SCOPE_COMPILE;
             }
 
-            Artifact artifact = artifactFactory.createArtifact( dep.getGroupId(), dep.getArtifactId(), dep.getVersion(),
-                                                                dep.getScope(), dep.getType() );
+            Artifact artifact = artifactFactory.createDependencyArtifact( groupId, artifactId, versionRange, type, classifier, scope, optional ) ;
 
-            if ( dep.getScope().equalsIgnoreCase( Artifact.SCOPE_SYSTEM ) )
+            if ( scope.equalsIgnoreCase( Artifact.SCOPE_SYSTEM ) )
             {
                 artifact.setFile( new File( dep.getSystemPath() ) );
             }