[MNG-4526] [regression] Shade plugin includes too much (relative to 2.2.1)

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@904308 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-01-28 23:44:51 +00:00
parent 8e1f46931a
commit 2f28a0483c
10 changed files with 328 additions and 0 deletions

View File

@ -87,6 +87,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng4544ActiveComponentCollectionThreadSafeTest.class ); suite.addTestSuite( MavenITmng4544ActiveComponentCollectionThreadSafeTest.class );
suite.addTestSuite( MavenITmng4536RequiresNoProjectForkingMojoTest.class ); suite.addTestSuite( MavenITmng4536RequiresNoProjectForkingMojoTest.class );
suite.addTestSuite( MavenITmng4526MavenProjectArtifactsScopeTest.class );
suite.addTestSuite( MavenITmng4522FailUponMissingDependencyParentPomTest.class ); suite.addTestSuite( MavenITmng4522FailUponMissingDependencyParentPomTest.class );
suite.addTestSuite( MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.class ); suite.addTestSuite( MavenITmng4500NoUpdateOfTimestampedSnapshotsTest.class );
suite.addTestSuite( MavenITmng4498IgnoreBrokenMetadataTest.class ); suite.addTestSuite( MavenITmng4498IgnoreBrokenMetadataTest.class );

View File

@ -0,0 +1,80 @@
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-4526">MNG-4526</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng4526MavenProjectArtifactsScopeTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng4526MavenProjectArtifactsScopeTest()
{
super( "[2.0.3,3.0-alpha-1),[3.0-alpha-7,)" );
}
/**
* Test that MavenProject.getArtifacts() only holds artifacts matching the scope requested by a mojo. This
* must also be the case when previously already artifacts from a wider scope were resolved.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4526" );
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.its.mng4526" );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
verifier.getCliOptions().add( "--settings" );
verifier.getCliOptions().add( "settings.xml" );
verifier.executeGoal( "generate-sources" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
List artifacts;
artifacts = verifier.loadLines( "target/compile.txt", "UTF-8" );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:a:jar:0.1" ) );
assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:b:jar:0.1" ) );
assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:c:jar:0.1" ) );
artifacts = verifier.loadLines( "target/runtime.txt", "UTF-8" );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:a:jar:0.1" ) );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:b:jar:0.1" ) );
assertFalse( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:c:jar:0.1" ) );
artifacts = verifier.loadLines( "target/test.txt", "UTF-8" );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:a:jar:0.1" ) );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:b:jar:0.1" ) );
assertTrue( artifacts.toString(), artifacts.contains( "org.apache.maven.its.mng4526:c:jar:0.1" ) );
}
}

View File

@ -0,0 +1,96 @@
<?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.mng4526</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-4526</name>
<description>
Test that MavenProject.getArtifacts() only holds artifacts matching the scope requested by a mojo.
</description>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng4526</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng4526</groupId>
<artifactId>b</artifactId>
<version>0.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.its.mng4526</groupId>
<artifactId>c</artifactId>
<version>0.1</version>
<scope>test</scope>
</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>test</id>
<phase>validate</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectArtifacts>target/test.txt</projectArtifacts>
</configuration>
</execution>
<execution>
<id>runtime</id>
<phase>initialize</phase>
<goals>
<goal>runtime</goal>
</goals>
<configuration>
<projectArtifacts>target/runtime.txt</projectArtifacts>
</configuration>
</execution>
<execution>
<id>compile</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<projectArtifacts>target/compile.txt</projectArtifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
<?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.mng4526</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,36 @@
<?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.mng4526</groupId>
<artifactId>b</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,36 @@
<?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.mng4526</groupId>
<artifactId>c</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,43 @@
<?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.
-->
<settings>
<profiles>
<profile>
<id>maven-core-it-repo</id>
<repositories>
<repository>
<id>maven-core-it</id>
<url>@baseurl@/repo</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-core-it-repo</activeProfile>
</activeProfiles>
</settings>