-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…in profile which is managed by <dependencyManagement> (#155) * Fixes #145, #148 add codes to parse the <version> for the dependency in profile which is managed by <dependencyManagement> * remove redundant code * add empty line at the end of files * remove profile-with-deps-inherit-parent-depMgmt-ci test * consolidate two blocks of code change into createCleanPom method * restore import change * restore import change * add test profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-oss * change test profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-oss to profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-oss-bom * code style fix * fix indents and licenses declaration in verify.groovy * set scope as compile and optional as false if not specified * fix scope and optional - code style Co-authored-by: yangnuoyu <yangnuoyu@penguin>
- Loading branch information
Showing
39 changed files
with
1,137 additions
and
14 deletions.
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
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
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
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
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
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
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
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
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
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
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
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
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-import</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>flatten-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>parent-depMngt</artifactId> | ||
<version>2</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<profiles> | ||
<profile> | ||
<id>test</id> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>dep</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
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,34 @@ | ||
/* | ||
* 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 'test' == 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.size() | ||
assert 'dep' == flattendProject.profiles.profile.dependencies.dependency.artifactId.text() | ||
assert '1.1' == flattendProject.profiles.profile.dependencies.dependency.version.text() |
19 changes: 19 additions & 0 deletions
19
...t/projects/profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-active/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,19 @@ | ||
<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-flatten-dep-all-active_parent</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>core</artifactId> | ||
<version>3.2.1</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> |
41 changes: 41 additions & 0 deletions
41
src/it/projects/profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-active/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,41 @@ | ||
<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-flatten-dep-all-active</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<parent> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-active_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> | ||
<flattenDependencyMode>all</flattenDependencyMode> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>test</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.mojo.flatten.its</groupId> | ||
<artifactId>core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
37 changes: 37 additions & 0 deletions
37
...it/projects/profile-with-deps-inherit-parent-depMgmt-flatten-dep-all-active/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,37 @@ | ||
/* | ||
* 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 'test' == 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 2 == flattendProject.dependencies.dependency.size() | ||
assert 'core' == flattendProject.dependencies.dependency[0].artifactId.text() | ||
assert 1 == flattendProject.dependencies.dependency[0].exclusions.exclusion.size() | ||
assert 'dep' == flattendProject.dependencies.dependency[1].artifactId.text() | ||
assert 1 == flattendProject.profiles.profile.dependencies.dependency.size() | ||
assert 'core' == flattendProject.profiles.profile.dependencies.dependency.artifactId.text() | ||
assert '3.2.1' == flattendProject.profiles.profile.dependencies.dependency.version.text() |
Oops, something went wrong.