mirror of https://github.com/apache/maven.git
[MNG-3023] Updating integration test to check three distinct cases where sibling dependencies might be referenced.
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@742749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e54f41964d
commit
77768ca298
|
@ -208,6 +208,7 @@ public class IntegrationTestSuite
|
||||||
suite.addTestSuite( MavenITmng3106ProfileMultipleActivatorsTest.class );
|
suite.addTestSuite( MavenITmng3106ProfileMultipleActivatorsTest.class );
|
||||||
suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPomTest.class );
|
suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPomTest.class );
|
||||||
suite.addTestSuite( MavenITmng3052DepRepoAggregationTest.class );
|
suite.addTestSuite( MavenITmng3052DepRepoAggregationTest.class );
|
||||||
|
suite.addTestSuite( MavenITmng3023ReactorDependencyResolutionTest.class );
|
||||||
suite.addTestSuite( MavenITmng3012CoreClassImportTest.class );
|
suite.addTestSuite( MavenITmng3012CoreClassImportTest.class );
|
||||||
suite.addTestSuite( MavenITmng2972OverridePluginDependencyTest.class );
|
suite.addTestSuite( MavenITmng2972OverridePluginDependencyTest.class );
|
||||||
suite.addTestSuite( MavenITmng2926PluginPrefixOrderTest.class );
|
suite.addTestSuite( MavenITmng2926PluginPrefixOrderTest.class );
|
||||||
|
|
|
@ -23,11 +23,14 @@ import org.apache.maven.it.Verifier;
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3023">MNG-3023</a>
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3023">MNG-3023</a>
|
||||||
*
|
*
|
||||||
* @author Mark Hobson
|
* @author Mark Hobson
|
||||||
|
* @author jdcasey
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class MavenITmng3023ReactorDependencyResolutionTest
|
public class MavenITmng3023ReactorDependencyResolutionTest
|
||||||
|
@ -35,20 +38,112 @@ public class MavenITmng3023ReactorDependencyResolutionTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Test that reactor projects are included in dependency resolution.
|
* Test that reactor projects are included in dependency resolution.
|
||||||
|
*
|
||||||
|
* In this pass, the dependency artifact should be missing from the local repository, and since
|
||||||
|
* the 'compile' phase has not been called, the dependency project artifact should not have a
|
||||||
|
* file associated with it. Therefore, the dependency artifact should fail to resolve, and the
|
||||||
|
* build should fail.
|
||||||
*/
|
*/
|
||||||
public void testitMNG3023()
|
public void testitMNG3023A() throws Exception
|
||||||
|
{
|
||||||
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023" );
|
||||||
|
|
||||||
|
// First pass. Make sure the dependency cannot be resolved.
|
||||||
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
|
||||||
|
verifier.deleteArtifact( "org.apache.maven.its.mng3023", "dependency", "1", "jar" );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
verifier.executeGoal( "initialize" );
|
||||||
|
fail( "Expected failure to resolve dependency artifact without at least calling 'compile' phase." );
|
||||||
|
}
|
||||||
|
catch ( VerificationException e )
|
||||||
|
{
|
||||||
|
// expected.
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
verifier.resetStreams();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that reactor projects are included in dependency resolution.
|
||||||
|
*
|
||||||
|
* I this pass, the dependency artifact should have the file $(basedir)/dependency/target/classes
|
||||||
|
* (a directory) associated with it, since the 'compile' phase has run. This location should be
|
||||||
|
* present in the compile classpath output from the maven-it-plugin-dependency-resolution:compile
|
||||||
|
* mojo execution.
|
||||||
|
*/
|
||||||
|
public void testitMNG3023B()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023/plugin" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023" );
|
||||||
|
|
||||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
|
||||||
|
verifier.deleteArtifact( "org.apache.maven.its.mng3023", "dependency", "1", "jar" );
|
||||||
|
|
||||||
|
verifier.executeGoal( "compile" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
List compileClassPath = verifier.loadLines( "consumer/target/compile.classpath", "UTF-8" );
|
||||||
|
assertTrue( find( "dependency/target/classes", compileClassPath ) );
|
||||||
|
assertFalse( find( "dependency-1.jar", compileClassPath ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that reactor projects are included in dependency resolution.
|
||||||
|
*
|
||||||
|
* I this pass, the dependency should have been installed, so the dependency artifact should have
|
||||||
|
* a file of .../dependency-1.jar associated with it, since the 'install' phase has run. This
|
||||||
|
* location should be present in the compile classpath output from the
|
||||||
|
* maven-it-plugin-dependency-resolution:compile mojo execution.
|
||||||
|
*
|
||||||
|
* Afterwards, the a separate Maven call to the 'initialize' phase should succeed, since the
|
||||||
|
* dependency artifact has been installed locally. This second execution should use the jar file
|
||||||
|
* from the local repository in its classpath output.
|
||||||
|
*/
|
||||||
|
public void testitMNG3023C()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023" );
|
||||||
|
|
||||||
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
|
||||||
|
verifier.deleteArtifact( "org.apache.maven.its.mng3023", "dependency", "1", "jar" );
|
||||||
|
|
||||||
verifier.executeGoal( "install" );
|
verifier.executeGoal( "install" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3023/project" );
|
List compileClassPath = verifier.loadLines( "consumer/target/compile.classpath", "UTF-8" );
|
||||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
assertTrue( find( "dependency-1.jar", compileClassPath ) );
|
||||||
verifier.executeGoal( "org.apache.maven.its.it0122:maven-it-it0122-plugin:1.0:test" );
|
assertFalse( find( "dependency/target/classes", compileClassPath ) );
|
||||||
|
|
||||||
|
verifier.executeGoal( "initialize" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
compileClassPath = verifier.loadLines( "consumer/target/compile.classpath", "UTF-8" );
|
||||||
|
assertTrue( find( "dependency-1.jar", compileClassPath ) );
|
||||||
|
assertFalse( find( "dependency/target/classes", compileClassPath ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean find( String pathSubstr, List classPath )
|
||||||
|
{
|
||||||
|
for ( Iterator it = classPath.iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
String path = (String) it.next();
|
||||||
|
|
||||||
|
if ( path.indexOf( pathSubstr ) > -1 )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.apache.maven.its.mng3023</groupId>
|
||||||
|
<artifactId>parent</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>consumer</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.its.mng3023</groupId>
|
||||||
|
<artifactId>dependency</artifactId>
|
||||||
|
<version>1</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>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile-classpath</id>
|
||||||
|
<phase>initialize</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<compileClassPath>${project.build.directory}/compile.classpath</compileClassPath>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<project>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.apache.maven.its.mng3023</groupId>
|
||||||
|
<artifactId>parent</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>dependency</artifactId>
|
||||||
|
</project>
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.apache.maven.debug.mng2720;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
<project>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<name>Maven Integration Test :: it0122 :: Plugin</name>
|
|
||||||
<groupId>org.apache.maven.its.it0122</groupId>
|
|
||||||
<artifactId>maven-it-it0122-plugin</artifactId>
|
|
||||||
<packaging>maven-plugin</packaging>
|
|
||||||
<version>1.0</version>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven</groupId>
|
|
||||||
<artifactId>maven-plugin-api</artifactId>
|
|
||||||
<version>2.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,46 +0,0 @@
|
||||||
package org.apache.maven.its.it0122;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple Mojo that just requires compile-scope dependency resolution.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:markhobson@gmail.com">Mark Hobson</a>
|
|
||||||
* @version $Id$
|
|
||||||
* @goal test
|
|
||||||
* @requiresDependencyResolution compile
|
|
||||||
*/
|
|
||||||
public class TestMojo extends AbstractMojo
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @see org.apache.maven.plugin.Mojo#execute()
|
|
||||||
*/
|
|
||||||
public void execute() throws MojoExecutionException, MojoFailureException
|
|
||||||
{
|
|
||||||
getLog().info("Test Mojo executed");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +1,13 @@
|
||||||
<project>
|
<project>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<name>Maven Integration Test :: it0122</name>
|
|
||||||
<description>Test that reactor projects are included in dependency resolution.</description>
|
<description>Test that reactor projects are included in dependency resolution.</description>
|
||||||
<groupId>org.apache.maven.its.it0122</groupId>
|
<groupId>org.apache.maven.its.mng3023</groupId>
|
||||||
<artifactId>maven-it-it0122</artifactId>
|
<artifactId>parent</artifactId>
|
||||||
|
<version>1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.0</version>
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>dependency</module>
|
<module>dependency</module>
|
||||||
<module>main</module>
|
<module>consumer</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
|
@ -1,7 +0,0 @@
|
||||||
<project>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<name>Maven Integration Test :: it0122 :: Dependency</name>
|
|
||||||
<groupId>org.apache.maven.its.it0122</groupId>
|
|
||||||
<artifactId>maven-it-it0122-dependency</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
</project>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<project>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<name>Maven Integration Test :: it0122 :: Main</name>
|
|
||||||
<groupId>org.apache.maven.its.it0122</groupId>
|
|
||||||
<artifactId>maven-it-it0122-main</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.its.it0122</groupId>
|
|
||||||
<artifactId>maven-it-it0122-dependency</artifactId>
|
|
||||||
<version>1.0</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
Loading…
Reference in New Issue