add path references:

- maven.dependency.classpath (compile)
- maven.compile.classpath (compile)
- maven.runtime.classpath (runtime)
- maven.test.classpath (test)

resolve dependencies in ant run mojo to ensure these are available


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-23 03:24:18 +00:00
parent 74903851c4
commit ab0e585fdb
2 changed files with 17 additions and 1 deletions

View File

@ -23,6 +23,10 @@ import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.PropertyHelper;
import org.apache.tools.ant.Target;
import org.apache.tools.ant.types.Path;
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
/**
* @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
@ -51,6 +55,17 @@ public abstract class AbstractAntMojo
antTasks.getProject().addBuildListener( antLogger );
antTasks.getProject().setBaseDir( mavenProject.getBasedir() );
Path p = new Path( antTasks.getProject() );
p.setPath( StringUtils.join( mavenProject.getCompileClasspathElements().iterator(), File.pathSeparator ) );
antTasks.getProject().addReference( "maven.dependency.classpath", p );
antTasks.getProject().addReference( "maven.compile.classpath", p );
p = new Path( antTasks.getProject() );
p.setPath( StringUtils.join( mavenProject.getRuntimeClasspathElements().iterator(), File.pathSeparator ) );
antTasks.getProject().addReference( "maven.runtime.classpath", p );
p = new Path( antTasks.getProject() );
p.setPath( StringUtils.join( mavenProject.getTestClasspathElements().iterator(), File.pathSeparator ) );
antTasks.getProject().addReference( "maven.test.classpath", p );
getLog().info( "Executing tasks" );
antTasks.execute();

View File

@ -38,7 +38,8 @@ import org.apache.tools.ant.Target;
* @goal run
*
* @description Runs the nested ant tasks
*
*
* @requiresDependencyResolution
*/
public class AntRunMojo
extends AbstractAntMojo