mirror of https://github.com/apache/maven.git
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:
parent
74903851c4
commit
ab0e585fdb
|
@ -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();
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.tools.ant.Target;
|
|||
*
|
||||
* @description Runs the nested ant tasks
|
||||
*
|
||||
* @requiresDependencyResolution
|
||||
*/
|
||||
public class AntRunMojo
|
||||
extends AbstractAntMojo
|
||||
|
|
Loading…
Reference in New Issue