You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/07/22 18:51:18 UTC

svn commit: r224365 - in /maven/components/trunk: maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java maven-project/src/main/java/org/apache/maven/project/MavenProject.java

Author: brett
Date: Fri Jul 22 09:51:09 2005
New Revision: 224365

URL: http://svn.apache.org/viewcvs?rev=224365&view=rev
Log:
PR: MNG-579
correct inclusion of tlds

Modified:
    maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java

Modified: maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java?rev=224365&r1=224364&r2=224365&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/WarMojo.java Fri Jul 22 09:51:09 2005
@@ -33,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Build a war/webapp.
@@ -155,25 +156,33 @@
             FileUtils.copyDirectoryStructure( classesDirectory, webappClassesDirectory );
         }
 
-        List runtimeArtifacts = project.getRuntimeArtifacts();
+        Set artifacts = project.getArtifacts();
 
-        for ( Iterator iter = runtimeArtifacts.iterator(); iter.hasNext(); )
+        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
         {
             Artifact artifact = (Artifact) iter.next();
 
+            // TODO: utilise appropriate methods from project builder
             // TODO: scope handler
             // Include runtime and compile time libraries
-            // [jc, 21-June]: handle TLDs as a special-case.
-            if ( "tld".equals( artifact.getType() ) )
+            if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) &&
+                !!Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
             {
-                FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
-            }
-            // [jc, 21-June]: I'm removing ( "jar".equals( artifact.getType() ) ) from consideration here
-            // we'll handle anything that's in the runtime classpath and NOT a SCOPE_PROVIDED artifact.
-            else if ( !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) )
-            {
-                FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
+                String type = artifact.getType();
+                if ( "tld".equals( type ) )
+                {
+                    FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
+                }
+                else if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
+                {
+                    FileUtils.copyFileToDirectory( artifact.getFile(), libDirectory );
+                }
+                else
+                {
+                    getLog().debug( "Skipping artifact of type " + type + " for WEB-INF/lib" );
+                }
             }
+
         }
     }
 

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=224365&r1=224364&r2=224365&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java (original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/MavenProject.java Fri Jul 22 09:51:09 2005
@@ -331,6 +331,7 @@
         {
             Artifact a = (Artifact) i.next();
 
+            // TODO: classpath check doesn't belong here - that's the other method
             if ( isAddedToClasspath( a ) )
             {
                 // TODO: let the scope handler deal with this
@@ -412,6 +413,7 @@
         {
             Artifact a = (Artifact) i.next();
 
+            // TODO: classpath check doesn't belong here - that's the other method
             if ( isAddedToClasspath( a ) )
             {
                 // TODO: let the scope handler deal with this
@@ -494,6 +496,7 @@
         {
             Artifact a = (Artifact) i.next();
 
+            // TODO: classpath check doesn't belong here - that's the other method
             if ( isAddedToClasspath( a ) )
             {
                 // TODO: let the scope handler deal with this
@@ -543,12 +546,7 @@
         String type = artifact.getType();
 
         // TODO: utilise type handler
-        if ( "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type ) )
-        {
-            return true;
-        }
-
-        return false;
+        return "jar".equals( type ) || "ejb".equals( type ) || "ejb-client".equals( type );
     }
 
     // ----------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org