forked from apache/maven
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apache#291 use scope/optional in profile over default
If the scope/optional for a dependency with an entry in dependency management is explicitly defined in a profile dependency but not in the dependency management section, then use the scope/optional defined in the profile dependency rather than falling back to the default value
- Loading branch information
1 parent
5a86896
commit 374abca
Showing
7 changed files
with
210 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
.../projects/profile-with-deps-inherit-parent-depMgmt-jdk-optional-in-profile/parent/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,23 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-jdk-optional-in-profile_parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<javax.annotations.version>1.3.2</javax.annotations.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<version>${javax.annotations.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
42 changes: 42 additions & 0 deletions
42
src/it/projects/profile-with-deps-inherit-parent-depMgmt-jdk-optional-in-profile/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,42 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-jdk-optional-in-profile</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<parent> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-jdk-optional-in-profile_parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<relativePath>parent</relativePath> | ||
</parent> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>flatten-maven-plugin</artifactId> | ||
<configuration> | ||
<embedBuildProfileDependencies>true</embedBuildProfileDependencies> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>java9</id> | ||
<activation> | ||
<jdk>[1.9,)</jdk> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
...t/projects/profile-with-deps-inherit-parent-depMgmt-jdk-optional-in-profile/verify.groovy
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,35 @@ | ||
/* | ||
* 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. | ||
*/ | ||
File originalPom = new File( basedir, 'pom.xml' ) | ||
assert originalPom.exists() | ||
|
||
def originalProject = new XmlSlurper().parse( originalPom ) | ||
assert 0 == originalProject.dependencies.size() | ||
assert 'java9' == originalProject.profiles.profile.id.text() | ||
assert 1 == originalProject.profiles.profile.dependencies.size() | ||
|
||
File flattendPom = new File( basedir, '.flattened-pom.xml' ) | ||
assert flattendPom.exists() | ||
|
||
def flattendProject = new XmlSlurper().parse( flattendPom ) | ||
assert 0 == flattendProject.dependencies.size() | ||
assert 1 == flattendProject.profiles.profile.dependencies.dependency.size() | ||
assert 'javax.annotation-api' == flattendProject.profiles.profile.dependencies.dependency.artifactId.text() | ||
assert '1.3.2' == flattendProject.profiles.profile.dependencies.dependency.version.text() | ||
assert 'true' == flattendProject.profiles.profile.dependencies.dependency.optional.text() |
23 changes: 23 additions & 0 deletions
23
src/it/projects/profile-with-deps-inherit-parent-depMgmt-jdk-scope-in-profile/parent/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,23 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-jdk-scope-in-profile_parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<javax.annotations.version>1.3.2</javax.annotations.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<version>${javax.annotations.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
42 changes: 42 additions & 0 deletions
42
src/it/projects/profile-with-deps-inherit-parent-depMgmt-jdk-scope-in-profile/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,42 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-jdk-scope-in-profile</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<parent> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-jdk-scope-in-profile_parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<relativePath>parent</relativePath> | ||
</parent> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>flatten-maven-plugin</artifactId> | ||
<configuration> | ||
<embedBuildProfileDependencies>true</embedBuildProfileDependencies> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>java9</id> | ||
<activation> | ||
<jdk>[1.9,)</jdk> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
35 changes: 35 additions & 0 deletions
35
src/it/projects/profile-with-deps-inherit-parent-depMgmt-jdk-scope-in-profile/verify.groovy
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,35 @@ | ||
/* | ||
* 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. | ||
*/ | ||
File originalPom = new File( basedir, 'pom.xml' ) | ||
assert originalPom.exists() | ||
|
||
def originalProject = new XmlSlurper().parse( originalPom ) | ||
assert 0 == originalProject.dependencies.size() | ||
assert 'java9' == originalProject.profiles.profile.id.text() | ||
assert 1 == originalProject.profiles.profile.dependencies.size() | ||
|
||
File flattendPom = new File( basedir, '.flattened-pom.xml' ) | ||
assert flattendPom.exists() | ||
|
||
def flattendProject = new XmlSlurper().parse( flattendPom ) | ||
assert 0 == flattendProject.dependencies.size() | ||
assert 1 == flattendProject.profiles.profile.dependencies.dependency.size() | ||
assert 'javax.annotation-api' == flattendProject.profiles.profile.dependencies.dependency.artifactId.text() | ||
assert '1.3.2' == flattendProject.profiles.profile.dependencies.dependency.version.text() | ||
assert 'provided' == flattendProject.profiles.profile.dependencies.dependency.scope.text() |
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