Skip to content

Commit

Permalink
switch to expand and adapt test case accordingly
Browse files Browse the repository at this point in the history
as discussed with @jglick as the intention of the flatten plugin here is to have
a self contained pom - this will switch to expand which will also have the benefit
of picking up any <dependencyManagement> configured in the parent(s).
  • Loading branch information
jtnord committed Mar 9, 2023
1 parent 30885c8 commit 6616939
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.56-SNAPSHOT</version>
<version>4.56-flatten-expand-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Jenkins Plugin Parent POM</name>
Expand Down Expand Up @@ -1313,9 +1313,9 @@
</goals>
<phase>process-resources</phase>
<configuration>
<!-- flattenMode:oss does not keep dependecnyMangement or will promote all transitive dependencies to direct ones, changing resolution order -->
<!-- flattenMode:oss does not keep dependencyMangement or will promote all transitive dependencies to direct ones, changing resolution order -->
<pomElements>
<dependencyManagement>interpolate</dependencyManagement>
<dependencyManagement>expand</dependencyManagement>
<!-- from https://github.com/mojohaus/flatten-maven-plugin/blob/flatten-maven-plugin-1.3.0/src/main/java/org/codehaus/mojo/flatten/FlattenMode.java#L100 -->
<ciManagement>expand</ciManagement>
<contributors>expand</contributors>
Expand Down
18 changes: 6 additions & 12 deletions src/it/incrementals-and-plugin-bom/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@ String pomXml = new File(basedir, '../../local-repo/io/jenkins/plugins/increment
assert pomXml.contains('version>1.0-rc1234.deadbeef5678</version>')
// https://github.com/jenkinsci/plugin-pom/issues/705
// line endings need normalising
assert pomXml.replace("\r\n", "\n").contains('''
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.361.x</artifactId>
<version>1580.v47b_429a_c853a</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>'''.replace("\r\n", "\n"))
assert pomXml.matches('(?s).*<dependencyManagement>\\s*<dependencies>'
// something from the parent pom dependencyManagement
+ '.*<dependency>\\s*<groupId>javax.servlet</groupId>\\s*<artifactId>javax.servlet-api</artifactId>\\s*<version>3.1.0</version>\\s*</dependency>'
// something from the bom
+ '.*<dependency>\\s*<groupId>io.jenkins.plugins</groupId>\\s*<artifactId>caffeine-api</artifactId>\\s*<version>2.9.3-65.v6a_47d0f4d1fe</version>\\s*</dependency>'
+ '.*</dependencies>\\s*</dependencyManagement>.*')
return true

0 comments on commit 6616939

Please sign in to comment.