You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2006/01/11 19:30:15 UTC
svn commit: r368077 -
/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java
Author: carlos
Date: Wed Jan 11 10:30:11 2006
New Revision: 368077
URL: http://svn.apache.org/viewcvs?rev=368077&view=rev
Log:
Refactor, creating getPathFromArtifacts method
Modified:
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java
Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java?rev=368077&r1=368076&r2=368077&view=diff
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java (original)
+++ maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java Wed Jan 11 10:30:11 2006
@@ -18,6 +18,7 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -85,21 +86,7 @@
antProject.addReference( "maven.test.classpath", p );
/* set maven.plugin.classpath with plugin dependencies */
- List list = new ArrayList( artifacts.size() );
-
- for ( Iterator i = artifacts.iterator(); i.hasNext(); )
- {
- Artifact a = (Artifact) i.next();
- File file = a.getFile();
- if ( file == null )
- {
- throw new DependencyResolutionRequiredException( a );
- }
- list.add( file.getPath() );
- }
- p = new Path( antProject );
- p.setPath( StringUtils.join( list.iterator(), File.pathSeparator ) );
- antProject.addReference( "maven.plugin.classpath", p );
+ antProject.addReference( "maven.plugin.classpath", getPathFromArtifacts( artifacts, antProject ) );
getLog().info( "Executing tasks" );
@@ -112,4 +99,25 @@
throw new MojoExecutionException( "Error executing ant tasks", e );
}
}
+
+ public Path getPathFromArtifacts( Collection artifacts, Project antProject )
+ throws DependencyResolutionRequiredException
+ {
+ List list = new ArrayList( artifacts.size() );
+
+ for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+ {
+ Artifact a = (Artifact) i.next();
+ File file = a.getFile();
+ if ( file == null )
+ {
+ throw new DependencyResolutionRequiredException( a );
+ }
+ list.add( file.getPath() );
+ }
+ Path p = new Path( antProject );
+ p.setPath( StringUtils.join( list.iterator(), File.pathSeparator ) );
+ return p;
+ }
+
}