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 2008/02/28 01:55:34 UTC
svn commit: r631794 - in /maven/core-integration-testing/trunk:
core-integration-testing-plugins/
core-integration-testing-plugins/maven-it-plugin-project-interpolation/
core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/ja...
Author: brett
Date: Wed Feb 27 16:55:30 2008
New Revision: 631794
URL: http://svn.apache.org/viewvc?rev=631794&view=rev
Log:
[MNG-2339] integration test for MNG-2339, ${project.*} are interpreted in the wrong place
Added:
maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/
- copied from r631038, maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-touch/
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml (with props)
Modified:
maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml
maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
maven/core-integration-testing/trunk/core-integration-testing-plugins/pom.xml
Modified: maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml?rev=631794&r1=631038&r2=631794&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/pom.xml Wed Feb 27 16:55:30 2008
@@ -24,9 +24,9 @@
<version>2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <artifactId>maven-it-plugin-touch</artifactId>
+ <artifactId>maven-it-plugin-project-interpolation</artifactId>
<packaging>maven-plugin</packaging>
- <name>Maven Integration Test Plugin :: Touch</name>
+ <name>Maven Integration Test Plugin :: Project Interpolation</name>
<inceptionYear>2001</inceptionYear>
<dependencies>
<dependency>
@@ -34,20 +34,11 @@
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
+ <!-- Test the resolution of the version -->
<dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0</version>
+ <groupId>org.apache.maven.its</groupId>
+ <artifactId>maven-integration-test-helper</artifactId>
+ <version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-archiver</artifactId>
- <version>2.0</version>
- </dependency>
</dependencies>
</project>
Modified: maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java?rev=631794&r1=631038&r2=631794&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java (original)
+++ maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java Wed Feb 27 16:55:30 2008
@@ -19,12 +19,6 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Map;
/**
* @goal touch
@@ -36,116 +30,9 @@
public class CoreItMojo
extends AbstractMojo
{
- /**
- * @parameter expression="${project}"
- */
- private MavenProject project;
-
- /**
- * @parameter expression="${project.build.directory}"
- * @required
- */
- private String outputDirectory;
-
- /** Test setting of plugin-artifacts on the PluginDescriptor instance.
- * @parameter expression="${plugin.artifactMap}"
- * @required
- */
- private Map pluginArtifacts;
-
- /**
- * @parameter expression="target/test-basedir-alignment"
- */
- private File basedirAlignmentDirectory;
-
- /**
- * @parameter alias="pluginFile"
- */
- private String pluginItem = "foo";
-
- /**
- * @parameter
- */
- private String goalItem = "bar";
-
- /**
- * @parameter expression="${artifactToFile}"
- */
- private String artifactToFile;
-
- /**
- * @parameter expression="${fail}"
- */
- private boolean fail = false;
-
public void execute()
throws MojoExecutionException
{
- if ( fail )
- {
- throw new MojoExecutionException( "Failing per \'fail\' parameter (specified in pom or system properties)" );
- }
-
- touch( new File( outputDirectory ), "touch.txt" );
-
- // This parameter should be aligned to the basedir as the parameter type is specified
- // as java.io.File
-
- if ( basedirAlignmentDirectory.getPath().equals( "target/test-basedir-alignment" ) )
- {
- throw new MojoExecutionException( "basedirAlignmentDirectory not aligned" );
- }
-
- touch( basedirAlignmentDirectory, "touch.txt" );
-
- File outDir = new File( outputDirectory );
-
- // Test parameter setting
- if ( pluginItem != null )
- {
- touch( outDir, pluginItem );
- }
-
- if ( goalItem != null )
- {
- touch( outDir, goalItem );
- }
-
- if ( artifactToFile != null )
- {
- Artifact artifact = (Artifact) pluginArtifacts.get( artifactToFile );
-
- File artifactFile = artifact.getFile();
-
- String filename = artifactFile.getAbsolutePath().replace('/', '_').replace(':', '_') + ".txt";
-
- touch( outDir, filename );
- }
-
- project.getBuild().setFinalName( "coreitified" );
- }
-
- private static void touch( File dir, String file )
- throws MojoExecutionException
- {
- try
- {
- if ( !dir.exists() )
- {
- dir.mkdirs();
- }
-
- File touch = new File( dir, file );
-
- FileWriter w = new FileWriter( touch );
-
- w.write( file );
-
- w.close();
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error touching file", e );
- }
+ getLog().info( "Don't touch me!" );
}
}
Modified: maven/core-integration-testing/trunk/core-integration-testing-plugins/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-testing-plugins/pom.xml?rev=631794&r1=631793&r2=631794&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-testing-plugins/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-integration-testing-plugins/pom.xml Wed Feb 27 16:55:30 2008
@@ -19,6 +19,7 @@
<module>maven-it-plugin-no-project</module>
<module>maven-it-plugin-packaging</module>
<module>maven-it-plugin-parameter-implementation</module>
+ <module>maven-it-plugin-project-interpolation</module>
<module>maven-it-plugin-setter</module>
<module>maven-it-plugin-touch</module>
<module>maven-it-plugin-uses-properties</module>
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java?rev=631794&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java Wed Feb 27 16:55:30 2008
@@ -0,0 +1,37 @@
+package org.apache.maven.integrationtests;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+public class MavenITmng2339BadProjectInterpolationTest
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng2339BadProjectInterpolationTest()
+ throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
+ {
+ super( "(2.0.8,)" ); // 2.0.9+
+ }
+
+ public void testitMNG2339()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2339-badProjectInterpolation" );
+
+ Verifier verifier;
+
+ verifier = new Verifier( testDir.getAbsolutePath() );
+
+ List cliOptions = new ArrayList();
+ cliOptions.add( "-Dversion=foo" );
+ verifier.setCliOptions( cliOptions );
+ verifier.executeGoal( "process-sources" );
+
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2339BadProjectInterpolationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml?rev=631794&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml Wed Feb 27 16:55:30 2008
@@ -0,0 +1,22 @@
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng2339</groupId>
+ <artifactId>bad-project-interpolation</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-project-interpolation</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>touch</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2339-badProjectInterpolation/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native