mirror of https://github.com/apache/maven.git
[MNG-5600] Dependency management import should support exclusions. (#269)
Co-authored-by: Christian Schulte <schulte@apache.org>
This commit is contained in:
parent
50f23340ea
commit
16a7489f46
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.maven.it;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.shared.verifier.Verifier;
|
||||
import org.apache.maven.shared.verifier.util.ResourceExtractor;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* [MNG-5600] Dependency management import should support exclusions.
|
||||
*
|
||||
* @author Christian Schulte
|
||||
*/
|
||||
class MavenITmng5600DependencyManagementImportExclusionsTest extends AbstractMavenIntegrationTestCase {
|
||||
|
||||
MavenITmng5600DependencyManagementImportExclusionsTest() {
|
||||
super("[4.0.0-alpha-5,)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanExcludeDependenciesFromImport() throws Exception {
|
||||
final File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-5600/exclusions");
|
||||
|
||||
Verifier verifier = newVerifier(testDir.getAbsolutePath());
|
||||
verifier.setAutoclean(false);
|
||||
verifier.filterFile("../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterMap());
|
||||
|
||||
verifier.addCliArguments("-s", "settings.xml");
|
||||
verifier.addCliArguments("clean", "verify");
|
||||
verifier.execute();
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
final Properties properties = verifier.loadProperties("target/project.properties");
|
||||
assertEquals("1", properties.getProperty("project.dependencyManagement.dependencies"));
|
||||
assertEquals(
|
||||
"commons-lang:commons-lang:jar",
|
||||
properties.getProperty("project.dependencyManagement.dependencies.0.managementKey"));
|
||||
|
||||
assertEquals("2", properties.getProperty("project.dependencyManagement.dependencies.0.exclusions"));
|
||||
assertEquals(
|
||||
"commons-io",
|
||||
properties.getProperty("project.dependencyManagement.dependencies.0.exclusions.0.groupId"));
|
||||
|
||||
assertEquals(
|
||||
"commons-io",
|
||||
properties.getProperty("project.dependencyManagement.dependencies.0.exclusions.0.artifactId"));
|
||||
|
||||
assertEquals(
|
||||
"commons-logging",
|
||||
properties.getProperty("project.dependencyManagement.dependencies.0.exclusions.1.groupId"));
|
||||
|
||||
assertEquals(
|
||||
"commons-logging",
|
||||
properties.getProperty("project.dependencyManagement.dependencies.0.exclusions.1.artifactId"));
|
||||
}
|
||||
}
|
|
@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer {
|
|||
* the tests are to finishing. Newer tests are also more likely to fail, so this is
|
||||
* a fail fast technique as well.
|
||||
*/
|
||||
suite.addTestSuite(MavenITmng5600DependencyManagementImportExclusionsTest.class);
|
||||
suite.addTestSuite(MavenITmng7740ConsumerBuildShouldCleanUpOldFilesTest.class);
|
||||
suite.addTestSuite(MavenITmng7587Jsr330.class);
|
||||
suite.addTestSuite(MavenITmng7038RootdirTest.class);
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<?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.mng5600</groupId>
|
||||
<artifactId>0</artifactId>
|
||||
<version>20160619</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Maven Integration Test :: MNG-5600</name>
|
||||
|
||||
<description>Tests that dependency management import exclusions are supported.</description>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.mng5600</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<!-- Exclude commons-io from BOM and from all imported dependencies. -->
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<!-- Exclude commons-logging from all imported dependencies. -->
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-expression</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>eval</goal>
|
||||
</goals>
|
||||
<phase>verify</phase>
|
||||
<configuration>
|
||||
<expressions>
|
||||
<expression>project/dependencyManagement</expression>
|
||||
</expressions>
|
||||
<outputFile>${project.build.directory}/project.properties</outputFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,44 @@
|
|||
<?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.mng5600</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
|
@ -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>
|
Loading…
Reference in New Issue