-
Notifications
You must be signed in to change notification settings - Fork 70
[MNG-5600] Dependency management import should support exclusions #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| 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 java.io.File; | ||
| import java.util.Arrays; | ||
| import java.util.Map; | ||
| import java.util.Properties; | ||
|
|
||
| import org.apache.maven.it.util.ResourceExtractor; | ||
|
|
||
| import static junit.framework.Assert.assertEquals; | ||
|
|
||
| /** | ||
| * [MNG-5600] Dependency management import should support exclusions. | ||
| * | ||
| * @author Christian Schulte | ||
| */ | ||
| public class MavenITmng5600DependencyManagementImportExclusionsTest | ||
| extends AbstractMavenIntegrationTestCase | ||
| { | ||
|
|
||
| public MavenITmng5600DependencyManagementImportExclusionsTest() | ||
| { | ||
| super( "[3.7.0,)" ); | ||
| } | ||
|
|
||
| public void testCanExcludeDependenciesFromImport() | ||
| throws Exception | ||
| { | ||
| final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5600/exclusions" ); | ||
|
|
||
| final Verifier verifier = newVerifier( testDir.getAbsolutePath() ); | ||
| verifier.setAutoclean( false ); | ||
| verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", | ||
| (Map) verifier.newDefaultFilterProperties() ); | ||
|
|
||
| verifier.addCliOption( "-s" ); | ||
| verifier.addCliOption( "settings.xml" ); | ||
| verifier.executeGoals( Arrays.asList( new String[] | ||
| { | ||
| "clean", "verify" | ||
| } ) ); | ||
| verifier.verifyErrorFreeLog(); | ||
| verifier.resetStreams(); | ||
|
|
||
| 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" ) ); | ||
| } | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <?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> | ||
| <phase>verify</phase> | ||
| <goals> | ||
| <goal>eval</goal> | ||
| </goals> | ||
| <configuration> | ||
| <expressions> | ||
| <expression>project/dependencyManagement</expression> | ||
| </expressions> | ||
| <outputFile>${project.build.directory}/project.properties</outputFile> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the need for this file
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original author does not respond, so try to figure out. The repository contains 201 XML file with the same name but with different content. If you are familiar with IT tests in Maven you could tell is it needed or not. I guess the author wanted to follow convention. |
||
|
|
||
| <!-- | ||
| 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> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This IT doesn't reflect MNG-5600. The requests asks for exclusion of transitive dependencies, not direct dependencies.
To me excluding direct dependencies does not make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get you. If you exclude a dependency, then the actual excluded dependency and its all transitive dependencies are excluded. Maybe I misinterpret the change. Please clarify it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rfscholte that is exactly the case. Sometimes you import another pom that is itself a
dependencyManagementlikespring-boot-dependencies