-
Notifications
You must be signed in to change notification settings - Fork 69
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
[MNG-7982] IT’s for transitive dependency management #379
Closed
DidierLoiseau
wants to merge
2
commits into
apache:master
from
DidierLoiseau:feature/MNG-7982-transitive-dependency-management
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
...src/test/java/org/apache/maven/it/MavenITmng7982DependencyManagementTransitivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
* 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.List; | ||
|
||
import org.apache.maven.shared.verifier.Verifier; | ||
import org.apache.maven.shared.verifier.util.ResourceExtractor; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-7982">MNG-7982</a>. | ||
* | ||
* @author Didier Loiseau | ||
*/ | ||
public class MavenITmng7982DependencyManagementTransitivityTest extends AbstractMavenIntegrationTestCase { | ||
|
||
public MavenITmng7982DependencyManagementTransitivityTest() { | ||
super("[4.0.0-beta-5,)"); | ||
} | ||
|
||
/** | ||
* Verify the effective dependency versions determined when using the transitive dependency management (default). | ||
* <p> | ||
* By default, the dependency management of transitive dependencies should be taken into account. | ||
* | ||
* @throws Exception in case of failure | ||
*/ | ||
@Test | ||
public void testitWithTransitiveDependencyManager() throws Exception { | ||
File testDir = | ||
ResourceExtractor.simpleExtractResources(getClass(), "/mng-7982-transitive-dependency-management"); | ||
|
||
Verifier verifier = newVerifier(testDir.getAbsolutePath()); | ||
verifier.deleteArtifacts("org.apache.maven.its.mng7982"); | ||
verifier.addCliArgument("-s"); | ||
verifier.addCliArgument("settings.xml"); | ||
verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); | ||
verifier.addCliArgument("verify"); | ||
verifier.execute(); | ||
verifier.verifyErrorFreeLog(); | ||
|
||
List<String> bClasspath = verifier.loadLines("b/target/classpath.txt", "UTF-8"); | ||
assertTrue(bClasspath.toString(), bClasspath.contains("a-1.jar")); | ||
assertFalse(bClasspath.toString(), bClasspath.contains("a-2.jar")); | ||
|
||
List<String> cClasspath = verifier.loadLines("c/target/classpath.txt", "UTF-8"); | ||
assertTrue(cClasspath.toString(), cClasspath.contains("b-1.jar")); | ||
assertFalse(cClasspath.toString(), cClasspath.contains("a-1.jar")); | ||
assertTrue(cClasspath.toString(), cClasspath.contains("a-2.jar")); | ||
|
||
List<String> dClasspath = verifier.loadLines("d/target/classpath.txt", "UTF-8"); | ||
assertTrue(dClasspath.toString(), dClasspath.contains("c-1.jar")); | ||
assertTrue(dClasspath.toString(), dClasspath.contains("b-1.jar")); | ||
assertFalse(dClasspath.toString(), dClasspath.contains("a-1.jar")); | ||
assertTrue(dClasspath.toString(), dClasspath.contains("a-2.jar")); | ||
|
||
List<String> eClasspath = verifier.loadLines("e/target/classpath.txt", "UTF-8"); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("d-1.jar")); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("c-1.jar")); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("b-1.jar")); | ||
assertFalse(eClasspath.toString(), eClasspath.contains("a-1.jar")); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("a-2.jar")); | ||
} | ||
|
||
/** | ||
* Verify the effective dependency versions determined when disabling the transitive dependency management (Maven 2/3 behavior). | ||
* <p> | ||
* When transitivity is disabled, the dependency management of transitive dependencies should is ignored. | ||
* | ||
* @throws Exception in case of failure | ||
*/ | ||
@Test | ||
public void testitWithTransitiveDependencyManagerDisabled() throws Exception { | ||
File testDir = | ||
ResourceExtractor.simpleExtractResources(getClass(), "/mng-7982-transitive-dependency-management"); | ||
|
||
Verifier verifier = newVerifier(testDir.getAbsolutePath()); | ||
verifier.deleteArtifacts("org.apache.maven.its.mng7982"); | ||
verifier.addCliArgument("-s"); | ||
verifier.addCliArgument("settings.xml"); | ||
verifier.filterFile("settings-template.xml", "settings.xml", "UTF-8"); | ||
verifier.addCliArgument("verify"); | ||
verifier.addCliArgument("-Dmaven.resolver.dependencyManagerTransitivity=false"); | ||
verifier.execute(); | ||
verifier.verifyErrorFreeLog(); | ||
|
||
List<String> bClasspath = verifier.loadLines("b/target/classpath.txt", "UTF-8"); | ||
assertTrue(bClasspath.toString(), bClasspath.contains("a-1.jar")); | ||
assertFalse(bClasspath.toString(), bClasspath.contains("a-2.jar")); | ||
|
||
List<String> cClasspath = verifier.loadLines("c/target/classpath.txt", "UTF-8"); | ||
assertTrue(cClasspath.toString(), cClasspath.contains("b-1.jar")); | ||
assertFalse(cClasspath.toString(), cClasspath.contains("a-1.jar")); | ||
assertTrue(cClasspath.toString(), cClasspath.contains("a-2.jar")); | ||
|
||
List<String> dClasspath = verifier.loadLines("d/target/classpath.txt", "UTF-8"); | ||
assertTrue(dClasspath.toString(), dClasspath.contains("c-1.jar")); | ||
assertTrue(dClasspath.toString(), dClasspath.contains("b-1.jar")); | ||
// dependency management of c is ignored | ||
assertTrue(dClasspath.toString(), dClasspath.contains("a-1.jar")); | ||
assertFalse(dClasspath.toString(), dClasspath.contains("a-2.jar")); | ||
|
||
List<String> eClasspath = verifier.loadLines("e/target/classpath.txt", "UTF-8"); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("d-1.jar")); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("c-1.jar")); | ||
assertTrue(eClasspath.toString(), eClasspath.contains("b-1.jar")); | ||
// dependency management of c is ignored | ||
assertTrue(dClasspath.toString(), dClasspath.contains("a-1.jar")); | ||
assertFalse(dClasspath.toString(), dClasspath.contains("a-2.jar")); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
core-it-suite/src/test/resources/mng-7982-transitive-dependency-management/b/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.1.0</modelVersion> | ||
|
||
<parent /> | ||
|
||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>b</artifactId> | ||
<version>1</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>a</artifactId> | ||
<version>1</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
45 changes: 45 additions & 0 deletions
45
core-it-suite/src/test/resources/mng-7982-transitive-dependency-management/c/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?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.1.0</modelVersion> | ||
|
||
<parent /> | ||
|
||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>c</artifactId> | ||
<version>1</version> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>a</artifactId> | ||
<version>2</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>b</artifactId> | ||
<version>1</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
36 changes: 36 additions & 0 deletions
36
core-it-suite/src/test/resources/mng-7982-transitive-dependency-management/d/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.1.0</modelVersion> | ||
|
||
<parent /> | ||
|
||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>d</artifactId> | ||
<version>1</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>c</artifactId> | ||
<version>1</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
36 changes: 36 additions & 0 deletions
36
core-it-suite/src/test/resources/mng-7982-transitive-dependency-management/e/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.1.0</modelVersion> | ||
|
||
<parent /> | ||
|
||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>e</artifactId> | ||
<version>1</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.its.mng7982</groupId> | ||
<artifactId>d</artifactId> | ||
<version>1</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should I update the
super()
above? Maybe keep the old test for[2.0.6,4.0.0)
and move these changes to a new test for[4.0.0,)
?I don’t know how this test suite is used for previous releases…
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.
It's not really used anymore. At least, we branched for Maven 3.x, not sure how we'll handle things for 4.0, 4.1, etc..., but I was actually considering merging ITs into maven to ease. I don't really see any good reason not to do that.