[MNG-2339] integration test for MNG-2339, ${project.*} are interpreted in the wrong place

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@631794 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2008-02-28 00:55:30 +00:00
parent de57562352
commit 769f9ee6c2
5 changed files with 142 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<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-it-plugins</artifactId>
<groupId>org.apache.maven.its.plugins</groupId>
<version>2.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-it-plugin-project-interpolation</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven Integration Test Plugin :: Project Interpolation</name>
<inceptionYear>2001</inceptionYear>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<!-- Test the resolution of the version -->
<dependency>
<groupId>org.apache.maven.its</groupId>
<artifactId>maven-integration-test-helper</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,38 @@
package org.apache.maven.plugin.coreit;
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
/**
* @goal touch
*
* @phase process-sources
*
* @description Goal which cleans the build
*/
public class CoreItMojo
extends AbstractMojo
{
public void execute()
throws MojoExecutionException
{
getLog().info( "Don't touch me!" );
}
}

View File

@ -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>

View File

@ -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();
}
}

View File

@ -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>