You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/06/21 19:13:25 UTC

svn commit: r191688 - 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: jdcasey
Date: Tue Jun 21 10:13:24 2005
New Revision: 191688

URL: http://svn.apache.org/viewcvs?rev=191688&view=rev
Log:
Fixing artifact handling to only process the runtime artifacts, and select out the tld's from that. This is for the war mojo, BTW. :)

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=191688&r1=191687&r2=191688&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 Tue Jun 21 10:13:24 2005
@@ -33,7 +33,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 
 /**
  * Build a war/webapp.
@@ -143,6 +142,7 @@
     }
 
     /**
+     * @throws MojoExecutionException 
      *
      */
     public void buildWebapp( MavenProject project )
@@ -162,29 +162,22 @@
             FileUtils.copyDirectoryStructure( classesDirectory, webappClassesDirectory );
         }
 
-        Set artifacts = project.getArtifacts();
+        List runtimeArtifacts = project.getRuntimeArtifacts();
 
-        for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+        for ( Iterator iter = runtimeArtifacts.iterator(); iter.hasNext(); )
         {
             Artifact artifact = (Artifact) iter.next();
 
             // TODO: scope handler
-            // TODO: use classpath instead
             // Include runtime and compile time libraries
-            
             // [jc, 21-June]: handle TLDs as a special-case.
             if ( "tld".equals( artifact.getType() ) )
             {
                 FileUtils.copyFileToDirectory( artifact.getFile(), tldDirectory );
             }
-            // [jc, 21-June]: filter POMs out of the /lib copy process.
-            else if ( "pom".equals( artifact.getType() ) )
-            {
-                // don't mess with these...they'd only be here for inclusion of dependencies.
-            }
             // [jc, 21-June]: I'm removing ( "jar".equals( artifact.getType() ) ) from consideration here
-            // we'll handle anything that's NOT a POM or a TLD as a binary library to go in /lib
-            else if ( !Artifact.SCOPE_TEST.equals( artifact.getScope() ) && !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) )
+            // 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 );
             }

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=191688&r1=191687&r2=191688&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 Tue Jun 21 10:13:24 2005
@@ -302,6 +302,26 @@
         return list;
     }
 
+    public List getCompileArtifacts()
+    {
+        List list = new ArrayList( getArtifacts().size() );
+
+        for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+        {
+            Artifact a = (Artifact) i.next();
+
+            if ( isAddedToClasspath( a ) )
+            {
+                // TODO: let the scope handler deal with this
+                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) )
+                {
+                    list.add( a );
+                }
+            }
+        }
+        return list;
+    }
+
     public List getCompileDependencies()
     {
         Set artifacts = getArtifacts();
@@ -348,8 +368,8 @@
             if ( isAddedToClasspath( a ) )
             {
                 // TODO: let the scope handler deal with this
-                if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
-                    Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+                if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() )
+                    || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
                 {
                     File file = a.getFile();
                     if ( file == null )
@@ -363,6 +383,27 @@
         return list;
     }
 
+    public List getTestArtifacts()
+    {
+        List list = new ArrayList( getArtifacts().size() );
+
+        for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+        {
+            Artifact a = (Artifact) i.next();
+
+            if ( isAddedToClasspath( a ) )
+            {
+                // TODO: let the scope handler deal with this
+                if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() )
+                    || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+                {
+                    list.add( a );
+                }
+            }
+        }
+        return list;
+    }
+
     public List getTestDependencies()
     {
         Set artifacts = getArtifacts();
@@ -379,8 +420,8 @@
             Artifact a = (Artifact) i.next();
 
             // TODO: let the scope handler deal with this
-            if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
-                Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+            if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() )
+                || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
             {
                 Dependency dependency = new Dependency();
 
@@ -424,6 +465,26 @@
         return list;
     }
 
+    public List getRuntimeArtifacts()
+    {
+        List list = new ArrayList( getArtifacts().size() );
+
+        for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
+        {
+            Artifact a = (Artifact) i.next();
+
+            if ( isAddedToClasspath( a ) )
+            {
+                // TODO: let the scope handler deal with this
+                if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+                {
+                    list.add( a );
+                }
+            }
+        }
+        return list;
+    }
+
     public List getRuntimeDependencies()
     {
         Set artifacts = getArtifacts();
@@ -866,7 +927,7 @@
     }
 
     public Xpp3Dom getGoalConfiguration( String pluginGroupId, String pluginArtifactId, String executionId,
-                                         String goalId )
+                                        String goalId )
     {
         Xpp3Dom dom = null;
 



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