[MNG-2339] enhance the interpolation test

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@632238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2008-02-29 06:52:41 +00:00
parent 6106f2b4f8
commit d7803e716a
4 changed files with 32 additions and 5 deletions

View File

@ -34,6 +34,11 @@
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0</version>
</dependency>
<!-- Test the resolution of the version -->
<dependency>
<groupId>org.apache.maven.its</groupId>

View File

@ -19,20 +19,36 @@ package org.apache.maven.plugin.coreit;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
/**
* @goal touch
* @goal check
*
* @phase process-sources
* @phase validate
*
* @description Goal which cleans the build
*/
public class CoreItMojo
extends AbstractMojo
{
/** @parameter */
private String myDirectory;
/** @parameter expression="${project}" */
private MavenProject project;
public void execute()
throws MojoExecutionException
{
getLog().info( "Don't touch me!" );
if ( !myDirectory.equals( project.getBasedir() + "/target/foo" ) )
{
throw new MojoExecutionException( "wrong directory: " + myDirectory );
}
String value = project.getProperties().getProperty( "myDirectory" );
if ( !value.equals( "${project.build.directory}/foo" ) )
{
throw new MojoExecutionException( "wrong directory: " + value );
}
}
}

View File

@ -48,7 +48,7 @@ public class MavenITmng2339BadProjectInterpolationTest
List cliOptions = new ArrayList();
cliOptions.add( "-Dversion=foo" );
verifier.setCliOptions( cliOptions );
verifier.executeGoal( "process-sources" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

View File

@ -9,14 +9,20 @@
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-project-interpolation</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<myDirectory>${myDirectory}</myDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>touch</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<myDirectory>${project.build.directory}/foo</myDirectory>
</properties>
</project>