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/05/17 03:04:43 UTC

svn commit: r170498 - /maven/components/trunk/maven-artifact-ant/sample.build.xml /maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java

Author: brett
Date: Mon May 16 18:04:43 2005
New Revision: 170498

URL: http://svn.apache.org/viewcvs?rev=170498&view=rev
Log:
PR: MNG-408
Add filesetId attribute to dependencies task

Modified:
    maven/components/trunk/maven-artifact-ant/sample.build.xml
    maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java

Modified: maven/components/trunk/maven-artifact-ant/sample.build.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-ant/sample.build.xml?rev=170498&r1=170497&r2=170498&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-ant/sample.build.xml (original)
+++ maven/components/trunk/maven-artifact-ant/sample.build.xml Mon May 16 18:04:43 2005
@@ -12,11 +12,15 @@
 
     <artifact:pom file="pom.xml" id="maven.project"/>
 
-    <artifact:dependencies pathId="dependency.classpath">
+    <artifact:dependencies pathId="dependency.classpath" filesetId="dependency.fileset">
       <dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
       <dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
       <localRepository refid="local.repository"/>
     </artifact:dependencies>
+
+    <copy todir="target/files">
+      <fileset refid="dependency.fileset" />
+    </copy>
 
     <artifact:install file="target/maven-artifact-ant-2.0-SNAPSHOT.jar">
       <localRepository refid="local.repository"/>

Modified: maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java?rev=170498&r1=170497&r2=170498&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java (original)
+++ maven/components/trunk/maven-artifact-ant/src/main/java/org/apache/maven/artifact/ant/DependenciesTask.java Mon May 16 18:04:43 2005
@@ -29,6 +29,7 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.FileList;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.FileSet;
 
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -53,6 +54,8 @@
 
     private String pathId;
 
+    private String filesetId;
+
     public void execute()
     {
         if ( localRepository == null )
@@ -99,9 +102,17 @@
             throw new BuildException( "Reference ID " + pathId + " already exists" );
         }
 
+        if ( getProject().getReference( filesetId ) != null )
+        {
+            throw new BuildException( "Reference ID " + filesetId + " already exists" );
+        }
+
         FileList fileList = new FileList();
         fileList.setDir( localRepository.getLocation() );
 
+        FileSet fileSet = new FileSet();
+        fileSet.setDir( fileList.getDir( getProject() ) );
+
         for ( Iterator i = result.getArtifacts().values().iterator(); i.hasNext(); )
         {
             Artifact artifact = (Artifact) i.next();
@@ -119,11 +130,21 @@
             file.setName( filename );
 
             fileList.addConfiguredFile( file );
+
+            fileSet.createInclude().setName( filename );
+        }
+
+        if ( pathId != null )
+        {
+            Path path = new Path( getProject() );
+            path.addFilelist( fileList );
+            getProject().addReference( pathId, path );
         }
 
-        Path path = new Path( getProject() );
-        path.addFilelist( fileList );
-        getProject().addReference( pathId, path );
+        if ( filesetId != null )
+        {
+            getProject().addReference( filesetId, fileSet );
+        }
     }
 
     private List createRemoteArtifactRepositories()
@@ -180,5 +201,15 @@
     public void setPathId( String pathId )
     {
         this.pathId = pathId;
+    }
+
+    public String getFilesetId()
+    {
+        return filesetId;
+    }
+
+    public void setFilesetId( String filesetId )
+    {
+        this.filesetId = filesetId;
     }
 }



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