From d7803e716ad82edded86ec2cd6ef57c3a527bd9e Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Fri, 29 Feb 2008 06:52:41 +0000 Subject: [PATCH] [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 --- .../pom.xml | 5 +++++ .../maven/plugin/coreit/CoreItMojo.java | 22 ++++++++++++++++--- ...nITmng2339BadProjectInterpolationTest.java | 2 +- .../mng-2339-badProjectInterpolation/pom.xml | 8 ++++++- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml b/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml index 932cd68973..901884cc4b 100644 --- a/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml +++ b/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml @@ -34,6 +34,11 @@ maven-plugin-api 2.0 + + org.apache.maven + maven-project + 2.0 + org.apache.maven.its diff --git a/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java b/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java index a955d0fa86..066f74c8b3 100644 --- a/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java +++ b/its/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java @@ -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 ); + } } } diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java index 6cd5ebd802..54e1aaad09 100644 --- a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java +++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java @@ -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(); diff --git a/its/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml b/its/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml index 984ba82c32..e1598b17c6 100644 --- a/its/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml +++ b/its/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml @@ -9,14 +9,20 @@ org.apache.maven.its.plugins maven-it-plugin-project-interpolation 2.1-SNAPSHOT + + ${myDirectory} + - touch + check + + ${project.build.directory}/foo +