[MNG-2486] ${project.version} evaluated to timestamped version if referring to SNAPSHOT

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@924761 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-03-18 13:18:31 +00:00
parent d74c83c25b
commit 5d1e6442da
6 changed files with 372 additions and 0 deletions

View File

@ -396,6 +396,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng2576MakeLikeReactorTest.class ); suite.addTestSuite( MavenITmng2576MakeLikeReactorTest.class );
suite.addTestSuite( MavenITmng2562TimestampTest.class ); suite.addTestSuite( MavenITmng2562TimestampTest.class );
suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class ); suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class );
suite.addTestSuite( MavenITmng2486TimestampedDependencyVersionInterpolationTest.class );
suite.addTestSuite( MavenITmng2432PluginPrefixOrderTest.class ); suite.addTestSuite( MavenITmng2432PluginPrefixOrderTest.class );
suite.addTestSuite( MavenITmng2387InactiveProxyTest.class ); suite.addTestSuite( MavenITmng2387InactiveProxyTest.class );
suite.addTestSuite( MavenITmng2363BasedirAwareFileActivatorTest.class ); suite.addTestSuite( MavenITmng2363BasedirAwareFileActivatorTest.class );

View File

@ -0,0 +1,89 @@
package org.apache.maven.it;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.List;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2486">MNG-2486</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng2486TimestampedDependencyVersionInterpolationTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng2486TimestampedDependencyVersionInterpolationTest()
{
super( "[2.0.5,)" );
}
/**
* Verify that the expression ${project.version} gets resolved to X-SNAPSHOT and not the actual timestamp
* during transitive dependency resolution. In part, this depends on the deployed SNAPSHOT POMs to retain their
* X-SNAPSHOT project version and not having it replaced with the timestamp version.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2486" );
Verifier verifier;
verifier = new Verifier( new File( testDir, "dep-a" ).getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng2486" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier = new Verifier( new File( testDir, "parent" ).getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier = new Verifier( new File( testDir, "dep-b" ).getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier = new Verifier( new File( testDir, "test" ).getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
// enforce remote resolution
verifier.deleteArtifacts( "org.apache.maven.its.mng2486" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
List files = verifier.loadLines( "target/classpath.txt", "UTF-8" );
assertTrue( files.toString(), files.contains( "dep-a-0.1-SNAPSHOT.jar" ) );
}
}

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>dep-a</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-2486 :: Dependency A</name>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/../repo</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-artifact</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<mainFile>pom.xml</mainFile>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>set</goal>
<goal>attach-pom</goal>
<goal>install</goal>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>parent</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>dep-b</artifactId>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-2486 :: Dependency B</name>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/../repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>dep-a</artifactId>
<!-- NOTE: Version managed by parent -->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-artifact</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<mainFile>pom.xml</mainFile>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>set</goal>
<goal>attach-pom</goal>
<goal>install</goal>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>parent</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-2486 :: Parent</name>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/../repo</url>
</repository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>dep-a</artifactId>
<!-- NOTE: Using an expression here is the crucial piece of the test -->
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-artifact</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<mainFile>pom.xml</mainFile>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>set</goal>
<goal>install</goal>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>test</artifactId>
<version>0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-2486</name>
<repositories>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/../repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<!-- In order to resolve the transitive dependency on dep-a:0.1-SNAPHOT, project.version needs to be resolved properly... -->
<groupId>org.apache.maven.its.mng2486</groupId>
<artifactId>dep-b</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<compileClassPath>target/classpath.txt</compileClassPath>
<significantPathLevels>1</significantPathLevels>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>