You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2007/02/24 05:52:22 UTC
svn commit: r511210 - in /maven/plugins/trunk/maven-antrun-plugin: ./
src/it/test6/ src/main/java/org/apache/maven/plugin/antrun/
src/main/java/org/apache/maven/plugin/antrun/components/
src/main/resources/ src/main/resources/META-INF/ src/main/resourc...
Author: brett
Date: Fri Feb 23 20:52:20 2007
New Revision: 511210
URL: http://svn.apache.org/viewvc?view=rev&rev=511210
Log:
roll back r462640, these tests are failing
Added:
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntPropertyHelper.java
- copied unchanged from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntPropertyHelper.java
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/
- copied from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java
- copied unchanged from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/components/AntTargetConverter.java
maven/plugins/trunk/maven-antrun-plugin/src/main/resources/
- copied from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/resources/
maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-INF/
- copied from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-INF/
maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-INF/plexus/
- copied from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-INF/plexus/
maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-INF/plexus/components.xml
- copied unchanged from r462640, maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-INF/plexus/components.xml
Modified:
maven/plugins/trunk/maven-antrun-plugin/pom.xml
maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java
maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java
maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/apache/maven/plugin/antrun/AntRunMojoTest.java
Modified: maven/plugins/trunk/maven-antrun-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/pom.xml?view=diff&rev=511210&r1=511209&r2=511210
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-antrun-plugin/pom.xml Fri Feb 23 20:52:20 2007
@@ -15,7 +15,9 @@
~ limitations under the License.
-->
-<project xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd' xmlns='http://maven.apache.org/POM/4.0.0'>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
@@ -36,11 +38,6 @@
</issueManagement>
<dependencies>
<dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-ant</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0.1</version>
@@ -105,5 +102,3 @@
</profile>
</profiles>
</project>
-
-
Modified: maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml?view=diff&rev=511210&r1=511209&r2=511210
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml (original)
+++ maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml Fri Feb 23 20:52:20 2007
@@ -2,9 +2,9 @@
<project name="test6">
<target name="test">
- <mkdir dir="${basedir}/target"/>
+
<!-- <taskdef name="antlr" classname="org.apache.tools.ant.taskdefs.optional.ANTLR"/> -->
-
+
<antlr target="calc.g" outputdirectory="target">
<classpath refid="maven.plugin.classpath"/>
</antlr>
Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java?view=diff&rev=511210&r1=511209&r2=511210
==============================================================================
--- 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 Fri Feb 23 20:52:20 2007
@@ -16,13 +16,26 @@
* limitations under the License.
*/
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+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.plugin.antrun.components.AntTargetConverter;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.ant.AntProjectPopulator;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
-
-import java.util.List;
+import org.apache.tools.ant.PropertyHelper;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.types.Path;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
+import org.codehaus.plexus.util.StringUtils;
/**
* Abstract class for the Antrun plugin
@@ -43,11 +56,113 @@
*/
private List artifacts;
- protected void populateAntProjectWithMavenInformation( MavenProject mavenProject, Project antProject )
+ /**
+ * @param antTasks
+ * @param mavenProject
+ * @throws MojoExecutionException
+ */
+ protected void executeTasks( Target antTasks, MavenProject mavenProject )
throws MojoExecutionException
{
- AntProjectPopulator app = new AntProjectPopulator();
+ if ( antTasks == null )
+ {
+ getLog().info( "No ant tasks defined - SKIPPED" );
+ return;
+ }
+
+ try
+ {
+ //TODO refactor - place the manipulation of the expressionEvaluator into a separated class.
+ ExpressionEvaluator exprEvaluator = (ExpressionEvaluator) antTasks.getProject()
+ .getReference( AntTargetConverter.MAVEN_EXPRESSION_EVALUATOR_ID );
+
+ Project antProject = antTasks.getProject();
+
+ PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper( antProject );
+ propertyHelper.setNext( new AntPropertyHelper( exprEvaluator, mavenProject.getArtifacts(), getLog() ) );
+
+ DefaultLogger antLogger = new DefaultLogger();
+ antLogger.setOutputPrintStream( System.out );
+ antLogger.setErrorPrintStream( System.err );
+ antLogger.setMessageOutputLevel( getLog().isDebugEnabled() ? Project.MSG_DEBUG : Project.MSG_INFO );
+
+ antProject.addBuildListener( antLogger );
+ antProject.setBaseDir( mavenProject.getBasedir() );
+
+ Path p = new Path( antProject );
+ p.setPath( StringUtils.join( mavenProject.getCompileClasspathElements().iterator(), File.pathSeparator ) );
+
+ /* maven.dependency.classpath it's deprecated as it's equal to maven.compile.classpath */
+ antProject.addReference( "maven.dependency.classpath", p );
+ antProject.addReference( "maven.compile.classpath", p );
+
+ p = new Path( antProject );
+ p.setPath( StringUtils.join( mavenProject.getRuntimeClasspathElements().iterator(), File.pathSeparator ) );
+ antProject.addReference( "maven.runtime.classpath", p );
- app.populateAntProjectWithMavenInformation( mavenProject, antProject, artifacts, getLog() );
+ 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 */
+ antProject.addReference( "maven.plugin.classpath", getPathFromArtifacts( artifacts, antProject ) );
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( "Executing tasks" );
+ }
+
+ antTasks.execute();
+
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( "Executed tasks" );
+ }
+ }
+ catch ( DependencyResolutionRequiredException e )
+ {
+ throw new MojoExecutionException( "DependencyResolutionRequiredException: " + e.getMessage(), e );
+ }
+ catch ( BuildException e )
+ {
+ throw new MojoExecutionException( "An Ant BuildException has occured: " + e.getMessage(), e );
+ }
+ catch ( Exception e )
+ {
+ throw new MojoExecutionException( "Error executing ant tasks: " + e.getMessage(), e );
+ }
}
+
+ /**
+ * @param artifacts
+ * @param antProject
+ * @return a path
+ * @throws DependencyResolutionRequiredException
+ */
+ public Path getPathFromArtifacts( Collection artifacts, Project antProject )
+ throws DependencyResolutionRequiredException
+ {
+ if ( artifacts == null )
+ {
+ return new Path( antProject );
+ }
+
+ 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;
+ }
+
}
Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java?view=diff&rev=511210&r1=511209&r2=511210
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java (original)
+++ maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java Fri Feb 23 20:52:20 2007
@@ -16,12 +16,12 @@
* limitations under the License.
*/
+import java.io.File;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.tools.ant.Target;
-import java.io.File;
-
/**
* Maven AntRun Mojo.
*
@@ -82,9 +82,7 @@
public void execute()
throws MojoExecutionException
{
- populateAntProjectWithMavenInformation( project, tasks.getProject() );
-
- tasks.execute();
+ executeTasks( tasks, project );
if ( sourceRoot != null )
{
Modified: maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/apache/maven/plugin/antrun/AntRunMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/apache/maven/plugin/antrun/AntRunMojoTest.java?view=diff&rev=511210&r1=511209&r2=511210
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/apache/maven/plugin/antrun/AntRunMojoTest.java (original)
+++ maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/apache/maven/plugin/antrun/AntRunMojoTest.java Fri Feb 23 20:52:20 2007
@@ -68,10 +68,8 @@
public void testDefaultProject()
throws Exception
{
- /*
String result = invokeMaven( "antrun-default-test", new Properties() );
assertTrue( result.indexOf( "[echo] Hello World!" ) != -1 );
- */
}
/**
@@ -82,7 +80,6 @@
public void testTasksAttributesProject()
throws Exception
{
- /*
Properties properties = new Properties();
String result = invokeMaven( "tasksattributes-test", properties );
@@ -91,7 +88,6 @@
properties.put( "maven.test.skip", "true" );
result = invokeMaven( "tasksattributes-test", properties );
assertTrue( result.indexOf( "[echo] To skip me" ) == -1 );
- */
}
/**
Re: svn commit: r511210 - in /maven/plugins/trunk/maven-antrun-plugin: ./ src/it/test6/ src/main/java/org/apache/maven/plugin/antrun/ src/main/java/org/apache/maven/plugin/antrun/components/ src/main/resources/ src/main/resources/META-INF/ src/main/resourc...
Posted by Brett Porter <br...@apache.org>.
On 24/02/2007, at 4:34 PM, Jason van Zyl wrote:
>
> On 23 Feb 07, at 11:52 PM 23 Feb 07, brett@apache.org wrote:
>
>> Author: brett
>> Date: Fri Feb 23 20:52:20 2007
>> New Revision: 511210
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=511210
>> Log:
>> roll back r462640, these tests are failing
>>
>
> Fine provided it's not just a snapshot deployment missing.
It could well be an old snapshot. I don't really have time to
experiment with it right now, so I'll leave it with you to try again
when you have a chance.
> And really it boils down to the continuum output being useless
> because I can't easily see it amongst a mass of crap it spits out.
Ok, let's get this sort of feedback over to the continuum-dev list
and start fixing up the annoying things so it's useful.
But I think this is a failure of the antrun tests - they don't
produce output to surefire-reports like other tests so they don't
appear in the test results. Something for the list you just put in SVN.
Cheers,
Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r511210 - in /maven/plugins/trunk/maven-antrun-plugin: ./ src/it/test6/ src/main/java/org/apache/maven/plugin/antrun/ src/main/java/org/apache/maven/plugin/antrun/components/ src/main/resources/ src/main/resources/META-INF/ src/main/resourc...
Posted by Jason van Zyl <ja...@maven.org>.
On 23 Feb 07, at 11:52 PM 23 Feb 07, brett@apache.org wrote:
> Author: brett
> Date: Fri Feb 23 20:52:20 2007
> New Revision: 511210
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=511210
> Log:
> roll back r462640, these tests are failing
>
Fine provided it's not just a snapshot deployment missing. And really
it boils down to the continuum output being useless because I can't
easily see it amongst a mass of crap it spits out.
D
> Added:
> maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AntPropertyHelper.java
> - copied unchanged from r462640, maven/plugins/trunk/maven-
> antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/
> AntPropertyHelper.java
> maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/components/
> - copied from r462640, maven/plugins/trunk/maven-antrun-
> plugin/src/main/java/org/apache/maven/plugin/antrun/components/
> maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/components/AntTargetConverter.java
> - copied unchanged from r462640, maven/plugins/trunk/maven-
> antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/
> components/AntTargetConverter.java
> maven/plugins/trunk/maven-antrun-plugin/src/main/resources/
> - copied from r462640, maven/plugins/trunk/maven-antrun-
> plugin/src/main/resources/
> maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-
> INF/
> - copied from r462640, maven/plugins/trunk/maven-antrun-
> plugin/src/main/resources/META-INF/
> maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-
> INF/plexus/
> - copied from r462640, maven/plugins/trunk/maven-antrun-
> plugin/src/main/resources/META-INF/plexus/
> maven/plugins/trunk/maven-antrun-plugin/src/main/resources/META-
> INF/plexus/components.xml
> - copied unchanged from r462640, maven/plugins/trunk/maven-
> antrun-plugin/src/main/resources/META-INF/plexus/components.xml
> Modified:
> maven/plugins/trunk/maven-antrun-plugin/pom.xml
> maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml
> maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AbstractAntMojo.java
> maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AntRunMojo.java
> maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/
> apache/maven/plugin/antrun/AntRunMojoTest.java
>
> Modified: maven/plugins/trunk/maven-antrun-plugin/pom.xml
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-
> plugin/pom.xml?view=diff&rev=511210&r1=511209&r2=511210
> ======================================================================
> ========
> --- maven/plugins/trunk/maven-antrun-plugin/pom.xml (original)
> +++ maven/plugins/trunk/maven-antrun-plugin/pom.xml Fri Feb 23
> 20:52:20 2007
> @@ -15,7 +15,9 @@
> ~ limitations under the License.
>
> -->
> -<project xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://
> maven.apache.org/maven-v4_0_0.xsd' xmlns='http://maven.apache.org/
> POM/4.0.0'>
> +<project xmlns="http://maven.apache.org/POM/4.0.0"
> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://
> maven.apache.org/maven-v4_0_0.xsd">
> <parent>
> <artifactId>maven-plugins</artifactId>
> <groupId>org.apache.maven.plugins</groupId>
> @@ -36,11 +38,6 @@
> </issueManagement>
> <dependencies>
> <dependency>
> - <groupId>org.apache.maven.shared</groupId>
> - <artifactId>maven-ant</artifactId>
> - <version>1.0-SNAPSHOT</version>
> - </dependency>
> - <dependency>
> <groupId>org.apache.maven</groupId>
> <artifactId>maven-plugin-api</artifactId>
> <version>2.0.1</version>
> @@ -105,5 +102,3 @@
> </profile>
> </profiles>
> </project>
> -
> -
>
> Modified: maven/plugins/trunk/maven-antrun-plugin/src/it/test6/
> build.xml
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-
> plugin/src/it/test6/build.xml?view=diff&rev=511210&r1=511209&r2=511210
> ======================================================================
> ========
> --- maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml
> (original)
> +++ maven/plugins/trunk/maven-antrun-plugin/src/it/test6/build.xml
> Fri Feb 23 20:52:20 2007
> @@ -2,9 +2,9 @@
> <project name="test6">
>
> <target name="test">
> - <mkdir dir="${basedir}/target"/>
> +
> <!-- <taskdef name="antlr"
> classname="org.apache.tools.ant.taskdefs.optional.ANTLR"/> -->
> -
> +
> <antlr target="calc.g" outputdirectory="target">
> <classpath refid="maven.plugin.classpath"/>
> </antlr>
>
> Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AbstractAntMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-
> plugin/src/main/java/org/apache/maven/plugin/antrun/
> AbstractAntMojo.java?view=diff&rev=511210&r1=511209&r2=511210
> ======================================================================
> ========
> --- 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 Fri Feb 23 20:52:20
> 2007
> @@ -16,13 +16,26 @@
> * limitations under the License.
> */
>
> +import java.io.File;
> +import java.util.ArrayList;
> +import java.util.Collection;
> +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.plugin.antrun.components.AntTargetConverter;
> import org.apache.maven.project.MavenProject;
> -import org.apache.maven.shared.ant.AntProjectPopulator;
> +import org.apache.tools.ant.BuildException;
> +import org.apache.tools.ant.DefaultLogger;
> import org.apache.tools.ant.Project;
> -
> -import java.util.List;
> +import org.apache.tools.ant.PropertyHelper;
> +import org.apache.tools.ant.Target;
> +import org.apache.tools.ant.types.Path;
> +import
> org.codehaus.plexus.component.configurator.expression.ExpressionEvalua
> tor;
> +import org.codehaus.plexus.util.StringUtils;
>
> /**
> * Abstract class for the Antrun plugin
> @@ -43,11 +56,113 @@
> */
> private List artifacts;
>
> - protected void populateAntProjectWithMavenInformation
> ( MavenProject mavenProject, Project antProject )
> + /**
> + * @param antTasks
> + * @param mavenProject
> + * @throws MojoExecutionException
> + */
> + protected void executeTasks( Target antTasks, MavenProject
> mavenProject )
> throws MojoExecutionException
> {
> - AntProjectPopulator app = new AntProjectPopulator();
> + if ( antTasks == null )
> + {
> + getLog().info( "No ant tasks defined - SKIPPED" );
> + return;
> + }
> +
> + try
> + {
> + //TODO refactor - place the manipulation of the
> expressionEvaluator into a separated class.
> + ExpressionEvaluator exprEvaluator =
> (ExpressionEvaluator) antTasks.getProject()
> + .getReference
> ( AntTargetConverter.MAVEN_EXPRESSION_EVALUATOR_ID );
> +
> + Project antProject = antTasks.getProject();
> +
> + PropertyHelper propertyHelper =
> PropertyHelper.getPropertyHelper( antProject );
> + propertyHelper.setNext( new AntPropertyHelper
> ( exprEvaluator, mavenProject.getArtifacts(), getLog() ) );
> +
> + DefaultLogger antLogger = new DefaultLogger();
> + antLogger.setOutputPrintStream( System.out );
> + antLogger.setErrorPrintStream( System.err );
> + antLogger.setMessageOutputLevel( getLog
> ().isDebugEnabled() ? Project.MSG_DEBUG : Project.MSG_INFO );
> +
> + antProject.addBuildListener( antLogger );
> + antProject.setBaseDir( mavenProject.getBasedir() );
> +
> + Path p = new Path( antProject );
> + p.setPath( StringUtils.join
> ( mavenProject.getCompileClasspathElements().iterator(),
> File.pathSeparator ) );
> +
> + /* maven.dependency.classpath it's deprecated as it's
> equal to maven.compile.classpath */
> + antProject.addReference( "maven.dependency.classpath",
> p );
> + antProject.addReference( "maven.compile.classpath", p );
> +
> + p = new Path( antProject );
> + p.setPath( StringUtils.join
> ( mavenProject.getRuntimeClasspathElements().iterator(),
> File.pathSeparator ) );
> + antProject.addReference( "maven.runtime.classpath", p );
>
> - app.populateAntProjectWithMavenInformation( mavenProject,
> antProject, artifacts, getLog() );
> + 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 */
> + antProject.addReference( "maven.plugin.classpath",
> getPathFromArtifacts( artifacts, antProject ) );
> +
> + if ( getLog().isInfoEnabled() )
> + {
> + getLog().info( "Executing tasks" );
> + }
> +
> + antTasks.execute();
> +
> + if ( getLog().isInfoEnabled() )
> + {
> + getLog().info( "Executed tasks" );
> + }
> + }
> + catch ( DependencyResolutionRequiredException e )
> + {
> + throw new MojoExecutionException
> ( "DependencyResolutionRequiredException: " + e.getMessage(), e );
> + }
> + catch ( BuildException e )
> + {
> + throw new MojoExecutionException( "An Ant
> BuildException has occured: " + e.getMessage(), e );
> + }
> + catch ( Exception e )
> + {
> + throw new MojoExecutionException( "Error executing ant
> tasks: " + e.getMessage(), e );
> + }
> }
> +
> + /**
> + * @param artifacts
> + * @param antProject
> + * @return a path
> + * @throws DependencyResolutionRequiredException
> + */
> + public Path getPathFromArtifacts( Collection artifacts,
> Project antProject )
> + throws DependencyResolutionRequiredException
> + {
> + if ( artifacts == null )
> + {
> + return new Path( antProject );
> + }
> +
> + 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;
> + }
> +
> }
>
> Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AntRunMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-
> plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java?
> view=diff&rev=511210&r1=511209&r2=511210
> ======================================================================
> ========
> --- maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AntRunMojo.java (original)
> +++ maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/
> apache/maven/plugin/antrun/AntRunMojo.java Fri Feb 23 20:52:20 2007
> @@ -16,12 +16,12 @@
> * limitations under the License.
> */
>
> +import java.io.File;
> +
> import org.apache.maven.plugin.MojoExecutionException;
> import org.apache.maven.project.MavenProject;
> import org.apache.tools.ant.Target;
>
> -import java.io.File;
> -
> /**
> * Maven AntRun Mojo.
> *
> @@ -82,9 +82,7 @@
> public void execute()
> throws MojoExecutionException
> {
> - populateAntProjectWithMavenInformation( project,
> tasks.getProject() );
> -
> - tasks.execute();
> + executeTasks( tasks, project );
>
> if ( sourceRoot != null )
> {
>
> Modified: maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/
> apache/maven/plugin/antrun/AntRunMojoTest.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-
> plugin/src/test/java/org/apache/maven/plugin/antrun/
> AntRunMojoTest.java?view=diff&rev=511210&r1=511209&r2=511210
> ======================================================================
> ========
> --- maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/
> apache/maven/plugin/antrun/AntRunMojoTest.java (original)
> +++ maven/plugins/trunk/maven-antrun-plugin/src/test/java/org/
> apache/maven/plugin/antrun/AntRunMojoTest.java Fri Feb 23 20:52:20
> 2007
> @@ -68,10 +68,8 @@
> public void testDefaultProject()
> throws Exception
> {
> - /*
> String result = invokeMaven( "antrun-default-test", new
> Properties() );
> assertTrue( result.indexOf( "[echo] Hello World!" ) != -1 );
> - */
> }
>
> /**
> @@ -82,7 +80,6 @@
> public void testTasksAttributesProject()
> throws Exception
> {
> - /*
> Properties properties = new Properties();
>
> String result = invokeMaven( "tasksattributes-test",
> properties );
> @@ -91,7 +88,6 @@
> properties.put( "maven.test.skip", "true" );
> result = invokeMaven( "tasksattributes-test", properties );
> assertTrue( result.indexOf( "[echo] To skip me" ) == -1 );
> - */
> }
>
> /**
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org