Author: carlos
Date: Tue Nov 29 18:29:20 2005
New Revision: 349863

URL: http://svn.apache.org/viewcvs?rev=349863&view=rev
Log:
Added maven.plugin.classpath reference
PR: MNG-1702

Modified:
    
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java
    maven/plugins/trunk/maven-antrun-plugin/src/site/apt/usage.apt

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=349863&r1=349862&r2=349863&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
 Tue Nov 29 18:29:20 2005
@@ -16,6 +16,13 @@
  * limitations under the License.
  */
 
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -26,14 +33,22 @@
 import org.apache.tools.ant.types.Path;
 import org.codehaus.plexus.util.StringUtils;
 
-import java.io.File;
-
 /**
  * @author <a href="mailto:[EMAIL PROTECTED]">Kenney Westerhof</a>
  */
 public abstract class AbstractAntMojo
     extends AbstractMojo
 {
+    
+    /**
+     * The plugin dependencies.
+     *
+     * @parameter expression="${plugin.artifacts}"
+     * @required
+     * @readonly
+     */
+    private List artifacts;
+    
     protected void executeTasks( Target antTasks, MavenProject mavenProject )
         throws MojoExecutionException
     {
@@ -65,6 +80,23 @@
             p = new Path( antProject );
             p.setPath( StringUtils.join( 
mavenProject.getTestClasspathElements().iterator(), File.pathSeparator ) );
             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 );
 
             getLog().info( "Executing tasks" );
 

Modified: maven/plugins/trunk/maven-antrun-plugin/src/site/apt/usage.apt
URL: 
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-antrun-plugin/src/site/apt/usage.apt?rev=349863&r1=349862&r2=349863&view=diff
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/site/apt/usage.apt (original)
+++ maven/plugins/trunk/maven-antrun-plugin/src/site/apt/usage.apt Tue Nov 29 
18:29:20 2005
@@ -52,7 +52,19 @@
   lifecycle phase. You can add a script to each lifecycle phase,
   by duplicating the <<<\<execution/\>>>> section and specifying
   a new phase.
+
   
+  You can use these classpath references:
+  
+  * <<<maven.dependency.classpath>>>
+
+  * <<<maven.compile.classpath>>>
+
+  * <<<maven.runtime.classpath>>>
+
+  * <<<maven.test.classpath>>>
+
+  * <<<maven.plugin.classpath>>>
   
   Below you can see how to indicate that ant has generated some more java
   source that needs to be included in the compilation phase. Note that the


Reply via email to