Skip to content

Commit

Permalink
GBLD-1309: interpolate from the effective pom
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeDemoulinGebit committed Nov 9, 2023
1 parent 746369b commit b8a469a
Show file tree
Hide file tree
Showing 58 changed files with 2,101 additions and 1,960 deletions.
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
</scm>

<properties>
<mavenVersion>3.5.4</mavenVersion>
<mavenVersion>3.8.7</mavenVersion>
<recommendedJavaBuildVersion>11</recommendedJavaBuildVersion>
<project.build.outputTimestamp>2023-05-09T19:54:01Z</project.build.outputTimestamp>
</properties>
Expand Down Expand Up @@ -188,7 +188,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.5.1</version>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down Expand Up @@ -282,8 +282,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<debug>false</debug>
<debug>true</debug>
<failIfNoProjects>true</failIfNoProjects>
<showErrors>true</showErrors>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
Expand All @@ -298,7 +299,7 @@
<goals>
<goal>${project.groupId}:${project.artifactId}:${project.version}:flatten -Drevision=1.2.3.4</goal>
</goals>
<projectsDirectory>src/it/gebit</projectsDirectory>
<projectsDirectory>src/it/projects</projectsDirectory>
<postBuildHookScript>verify</postBuildHookScript>
<preBuildHookScript>setup</preBuildHookScript>
</configuration>
Expand Down
146 changes: 73 additions & 73 deletions src/it/projects/bom-flattenMode/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
/*
* 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 groovy.xml.XmlSlurper

File originalPom = new File( basedir, 'bom/pom.xml' )
assert originalPom.exists()

def originalProject = new XmlSlurper().parse( originalPom )
// required and maven-plugin specific elements
assert '4.0.0' == originalProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == originalProject.parent.groupId.text()
assert 'bom' == originalProject.artifactId.text()
assert '${bom.project.version}' == originalProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 1 == originalProject.parent.size()
assert 1 == originalProject.dependencyManagement.size()
assert 1 == originalProject.dependencyManagement.dependencies.size()
assert 11 == originalProject.dependencyManagement.dependencies.dependency.size()

File flattendPom = new File( basedir, 'bom/.flattened-pom.xml' )
assert flattendPom.exists()

def flattendProject = new XmlSlurper().parse( flattendPom )
// required elements
assert '4.0.0' == flattendProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == flattendProject.groupId.text()
assert 'bom' == flattendProject.artifactId.text()
assert '0.9.1-beta1' == flattendProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 0 == flattendProject.build.size()
assert 1 == flattendProject.ciManagement.size()
assert 1 == flattendProject.contributors.size()
assert 1 == flattendProject.description.size()
assert 1 == flattendProject.developers.size()
assert 1 == flattendProject.distributionManagement.size()
assert 1 == flattendProject.issueManagement.size()
assert 1 == flattendProject.mailingLists.size()
assert 0 == flattendProject.modules.size()
assert 0 == flattendProject.name.size()
assert 1 == flattendProject.organization.size()
assert 0 == flattendProject.pluginRepositories.size()
assert 0 == flattendProject.prerequisites.size()
assert 1 == flattendProject.properties.size()
assert 0 == flattendProject.reporting.size()
assert 0 == flattendProject.reports.size()
assert 1 == flattendProject.scm.size()
assert 1 == flattendProject.url.size()

assert 0 == flattendProject.parent.size()
assert 1 == flattendProject.dependencyManagement.size()
assert 1 == flattendProject.dependencyManagement.dependencies.size()
assert 11 == flattendProject.dependencyManagement.dependencies.dependency.size()
assert 'spring-boot-dependencies' == flattendProject.dependencyManagement.dependencies.dependency[0].artifactId.text()
assert '1.1.0.RELEASE' == flattendProject.dependencyManagement.dependencies.dependency[0].version.text()

/*
* 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 groovy.xml.XmlSlurper

File originalPom = new File( basedir, 'bom/pom.xml' )
assert originalPom.exists()

def originalProject = new XmlSlurper().parse( originalPom )
// required and maven-plugin specific elements
assert '4.0.0' == originalProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == originalProject.parent.groupId.text()
assert 'bom' == originalProject.artifactId.text()
assert '${bom.project.version}' == originalProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 1 == originalProject.parent.size()
assert 1 == originalProject.dependencyManagement.size()
assert 1 == originalProject.dependencyManagement.dependencies.size()
assert 11 == originalProject.dependencyManagement.dependencies.dependency.size()

File flattendPom = new File( basedir, 'bom/.flattened-pom.xml' )
assert flattendPom.exists()

def flattendProject = new XmlSlurper().parse( flattendPom )
// required elements
assert '4.0.0' == flattendProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == flattendProject.groupId.text()
assert 'bom' == flattendProject.artifactId.text()
assert '0.9.1-beta1' == flattendProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 0 == flattendProject.build.size()
assert 1 == flattendProject.ciManagement.size()
assert 1 == flattendProject.contributors.size()
assert 1 == flattendProject.description.size()
assert 1 == flattendProject.developers.size()
assert 1 == flattendProject.distributionManagement.size()
assert 1 == flattendProject.issueManagement.size()
assert 1 == flattendProject.mailingLists.size()
assert 0 == flattendProject.modules.size()
assert 0 == flattendProject.name.size()
assert 1 == flattendProject.organization.size()
assert 0 == flattendProject.pluginRepositories.size()
assert 0 == flattendProject.prerequisites.size()
assert 1 == flattendProject.properties.size()
assert 0 == flattendProject.reporting.size()
assert 0 == flattendProject.reports.size()
assert 1 == flattendProject.scm.size()
assert 1 == flattendProject.url.size()

assert 0 == flattendProject.parent.size()
assert 1 == flattendProject.dependencyManagement.size()
assert 1 == flattendProject.dependencyManagement.dependencies.size()
assert 11 == flattendProject.dependencyManagement.dependencies.dependency.size()
assert 'spring-boot-dependencies' == flattendProject.dependencyManagement.dependencies.dependency[0].artifactId.text()
assert '1.1.0.RELEASE' == flattendProject.dependencyManagement.dependencies.dependency[0].version.text()

148 changes: 74 additions & 74 deletions src/it/projects/bom-pomElements/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
/*
* 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 groovy.xml.XmlSlurper

File originalPom = new File( basedir, 'bom/pom.xml' )
assert originalPom.exists()

def originalProject = new XmlSlurper().parse( originalPom )
// required and maven-plugin specific elements
assert '4.0.0' == originalProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == originalProject.parent.groupId.text()
assert 'bom' == originalProject.artifactId.text()
assert '${bom.project.version}' == originalProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 1 == originalProject.parent.size()
assert 1 == originalProject.dependencyManagement.size()
assert 1 == originalProject.dependencyManagement.dependencies.size()
assert 11 == originalProject.dependencyManagement.dependencies.dependency.size()

File flattendPom = new File( basedir, 'bom/.flattened-pom.xml' )
assert flattendPom.exists()

def flattendProject = new XmlSlurper().parse( flattendPom )
// required elements
assert '4.0.0' == flattendProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == flattendProject.groupId.text()
assert 'bom' == flattendProject.artifactId.text()
assert '0.9.1-beta1' == flattendProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 0 == flattendProject.build.size()
assert 0 == flattendProject.ciManagement.size()
assert 0 == flattendProject.contributors.size()
assert 0 == flattendProject.description.size()
assert 0 == flattendProject.developers.size()
assert 0 == flattendProject.distributionManagement.size()
assert 0 == flattendProject.issueManagement.size()
assert 0 == flattendProject.mailingLists.size()
assert 0 == flattendProject.modules.size()
assert 0 == flattendProject.name.size()
assert 0 == flattendProject.organization.size()
assert 0 == flattendProject.pluginRepositories.size()
assert 0 == flattendProject.prerequisites.size()
assert 0 == flattendProject.properties.size()
assert 0 == flattendProject.reporting.size()
assert 0 == flattendProject.reports.size()
assert 0 == flattendProject.scm.size()
assert 0 == flattendProject.url.size()

assert 0 == flattendProject.parent.size()
assert 1 == flattendProject.dependencyManagement.size()
assert 1 == flattendProject.dependencyManagement.dependencies.size()
// 259 = 11 - 1 + 249 (from expanded spring boot BOM)
assert 259 == flattendProject.dependencyManagement.dependencies.dependency.size()
assert 'spring-context' == flattendProject.dependencyManagement.dependencies.dependency[0].artifactId.text()
assert '4.0.8.RELEASE' == flattendProject.dependencyManagement.dependencies.dependency[0].version.text()

/*
* 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 groovy.xml.XmlSlurper

File originalPom = new File( basedir, 'bom/pom.xml' )
assert originalPom.exists()

def originalProject = new XmlSlurper().parse( originalPom )
// required and maven-plugin specific elements
assert '4.0.0' == originalProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == originalProject.parent.groupId.text()
assert 'bom' == originalProject.artifactId.text()
assert '${bom.project.version}' == originalProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 1 == originalProject.parent.size()
assert 1 == originalProject.dependencyManagement.size()
assert 1 == originalProject.dependencyManagement.dependencies.size()
assert 11 == originalProject.dependencyManagement.dependencies.dependency.size()

File flattendPom = new File( basedir, 'bom/.flattened-pom.xml' )
assert flattendPom.exists()

def flattendProject = new XmlSlurper().parse( flattendPom )
// required elements
assert '4.0.0' == flattendProject.modelVersion.text()
assert 'org.codehaus.mojo.flatten.its' == flattendProject.groupId.text()
assert 'bom' == flattendProject.artifactId.text()
assert '0.9.1-beta1' == flattendProject.version.text()
assert 'pom' == originalProject.packaging.text()
// banned elements for artifact
assert 0 == flattendProject.build.size()
assert 0 == flattendProject.ciManagement.size()
assert 0 == flattendProject.contributors.size()
assert 0 == flattendProject.description.size()
assert 0 == flattendProject.developers.size()
assert 0 == flattendProject.distributionManagement.size()
assert 0 == flattendProject.issueManagement.size()
assert 0 == flattendProject.mailingLists.size()
assert 0 == flattendProject.modules.size()
assert 0 == flattendProject.name.size()
assert 0 == flattendProject.organization.size()
assert 0 == flattendProject.pluginRepositories.size()
assert 0 == flattendProject.prerequisites.size()
assert 0 == flattendProject.properties.size()
assert 0 == flattendProject.reporting.size()
assert 0 == flattendProject.reports.size()
assert 0 == flattendProject.scm.size()
assert 0 == flattendProject.url.size()

assert 0 == flattendProject.parent.size()
assert 1 == flattendProject.dependencyManagement.size()
assert 1 == flattendProject.dependencyManagement.dependencies.size()
// 259 = 11 - 1 + 249 (from expanded spring boot BOM)
assert 259 == flattendProject.dependencyManagement.dependencies.dependency.size()
assert 'spring-context' == flattendProject.dependencyManagement.dependencies.dependency[0].artifactId.text()
assert '4.0.8.RELEASE' == flattendProject.dependencyManagement.dependencies.dependency[0].version.text()

Loading

0 comments on commit b8a469a

Please sign in to comment.