You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2006/11/28 23:11:17 UTC

svn commit: r480236 - in /maven/plugins/trunk/maven-idea-plugin/src: main/java/org/apache/maven/plugin/idea/ test/java/org/apache/maven/plugin/idea/ test/java/org/apache/maven/plugin/idea/stubs/

Author: dennisl
Date: Tue Nov 28 14:11:16 2006
New Revision: 480236

URL: http://svn.apache.org/viewvc?view=rev&rev=480236
Log:
[MIDEA-74] Plugin doesn't handle correctly WebModule dependency scope

o Exclude dependencies with scope set to system or test from being packaged with a webapp.

Modified:
    maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
    maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
    maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarMavenProjectWithProvidedDependencyStub.java

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java?view=diff&rev=480236&r1=480235&r2=480236
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java Tue Nov 28 14:11:16 2006
@@ -763,9 +763,12 @@
                 containerElement.addAttribute( "level", "module" );
                 Element methodAttribute = createElement( containerElement, "attribute" );
                 methodAttribute.addAttribute( "name", "method" );
-                if ( Artifact.SCOPE_PROVIDED.equalsIgnoreCase( artifact.getScope() ) )
+                if ( Artifact.SCOPE_PROVIDED.equalsIgnoreCase( artifact.getScope() )
+                    || Artifact.SCOPE_SYSTEM.equalsIgnoreCase( artifact.getScope() )
+                    || Artifact.SCOPE_TEST.equalsIgnoreCase( artifact.getScope() ) )
                 {
-                    methodAttribute.addAttribute( "value", "0" ); // If scope is provided, do not package.
+                    // If scope is provided, system or test - do not package.
+                    methodAttribute.addAttribute( "value", "0" );
                 }
                 else
                 {

Modified: maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java?view=diff&rev=480236&r1=480235&r2=480236
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/IdeaModuleTest.java Tue Nov 28 14:11:16 2006
@@ -138,6 +138,7 @@
     {
         List expectedLibs = new ArrayList();
         expectedLibs.add( "/WEB-INF/lib/maven-model-2.0.1.jar" );
+        expectedLibs.add( "/WEB-INF/lib/jdbc-stdext-2.0.jar" );
         expectedLibs.add( "/WEB-INF/lib/junit-3.8.1.jar" );
 
         Document imlDocument = executeMojo( "src/test/module-plugin-configs/provided-dep-plugin-config.xml" );
@@ -183,7 +184,15 @@
 
             if ( "/WEB-INF/lib/maven-model-2.0.1.jar".equals( attributeValue ) )
             {
-                assertEquals( "Test library method", "0", attribute.attributeValue( "value" ) );
+                assertEquals( "Test library method for provided dependency", "0", attribute.attributeValue( "value" ) );
+            }
+            else if ( "/WEB-INF/lib/jdbc-stdext-2.0.jar".equals( attributeValue ) )
+            {
+                assertEquals( "Test library method for system dependency", "0", attribute.attributeValue( "value" ) );
+            }
+            else if ( "/WEB-INF/lib/junit-3.8.1.jar".equals( attributeValue ) )
+            {
+                assertEquals( "Test library method for test dependency", "0", attribute.attributeValue( "value" ) );
             }
             else
             {

Modified: maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarMavenProjectWithProvidedDependencyStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarMavenProjectWithProvidedDependencyStub.java?view=diff&rev=480236&r1=480235&r2=480236
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarMavenProjectWithProvidedDependencyStub.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/test/java/org/apache/maven/plugin/idea/stubs/WarMavenProjectWithProvidedDependencyStub.java Tue Nov 28 14:11:16 2006
@@ -35,12 +35,16 @@
         List testArtifacts = new ArrayList();
 
         Artifact artifact = createArtifact( "org.apache.maven", "maven-model", "2.0.1" );
-
         artifact.setScope( Artifact.SCOPE_PROVIDED );
-
         testArtifacts.add( artifact );
 
-        testArtifacts.add( createArtifact( "junit", "junit", "3.8.1" ) );
+        Artifact artifact2 = createArtifact("javax.sql", "jdbc-stdext", "2.0");
+        artifact2.setScope( Artifact.SCOPE_SYSTEM );
+        testArtifacts.add( artifact2 );
+
+        Artifact artifact3 = createArtifact("junit", "junit", "3.8.1");
+        artifact3.setScope( Artifact.SCOPE_TEST );
+        testArtifacts.add( artifact3 );
 
         return testArtifacts;
     }
@@ -54,6 +58,14 @@
         dep.setArtifactId( "maven-model" );
         dep.setVersion( "2.0.1" );
         dep.setScope( Artifact.SCOPE_PROVIDED );
+        dependencies.add( dep );
+
+        dep = new Dependency();
+        dep.setGroupId( "javax.sql" );
+        dep.setArtifactId( "jdbc-stdext" );
+        dep.setVersion( "2.0" );
+        dep.setScope( Artifact.SCOPE_SYSTEM );
+        dep.setSystemPath( "${java.home}/lib/rt.jar" );
         dependencies.add( dep );
 
         dep = new Dependency();