Skip to content

Commit

Permalink
[MRELEASE-1053] - Populate scm info from current module instead of
Browse files Browse the repository at this point in the history
reactor
  • Loading branch information
kwin committed Nov 5, 2021
1 parent 468520a commit 38939c3
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ under the License.
-->
<project>
<parent>
<artifactId>regular-multi-module-project</artifactId>
<artifactId>regular-multi-module-project-parent</artifactId>
<groupId>org.apache.maven.plugin.release</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../module-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugin.release</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ under the License.
-->
<project>
<parent>
<artifactId>regular-multi-module-project</artifactId>
<artifactId>regular-multi-module-project-parent</artifactId>
<groupId>org.apache.maven.plugin.release</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../module-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugin.release</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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 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/maven-v4_0_0.xsd" child.project.url.inherit.append.path="false">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugin.release</groupId>
<artifactId>regular-multi-module-project-parent</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>parent-project</name>

<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="true">
<url>http://localhost/myscm/${project.scm.tag}</url>
<connection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/${project.scm.tag}/</connection>
<developerConnection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/${project.scm.tag}/</developerConnection>
<tag>trunk</tag>
</scm>


<properties>
<maven.compiler.source>@maven.compiler.source@</maven.compiler.source>
<maven.compiler.target>@maven.compiler.target@</maven.compiler.target>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>@project.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,16 @@
<version>1.0-SNAPSHOT</version>
<name>parent-project</name>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/</connection>
<developerConnection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/</developerConnection>
</scm>
<parent>
<groupId>org.apache.maven.plugin.release</groupId>
<artifactId>regular-multi-module-project-parent</artifactId>
<relativePath>module-parent/pom.xml</relativePath>
<version>1.0-SNAPSHOT</version>
</parent>

<properties>
<maven.compiler.source>@maven.compiler.source@</maven.compiler.source>
<maven.compiler.target>@maven.compiler.target@</maven.compiler.target>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>@project.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>module-a</module>
<module>module-b</module>
<module>module-parent</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,22 @@ try
String expected1 = "Full run would tag working copy '" + basedir + "'";
String expected2 = " with label 'regular-multi-module-project-1.0'";

if( contents.indexOf( expected1 ) != -1 && contents.indexOf( expected2 ) != -1 )
{
return true;
}
assert contents.indexOf( expected1 ) != -1
assert contents.indexOf( expected2 ) != -1
// check parent project
def project = new XmlSlurper().parse( new File( new File (basedir, "module-parent"), "pom.xml.next" ) )
assert project.version.text() == '1.1-SNAPSHOT'
assert project.scm.url.text() == 'http://localhost/myscm/${project.scm.tag}'

// check reactor root project
project = new XmlSlurper().parse( new File (basedir, "pom.xml.next" ) )
assert 0 == project.scm.size() // scm element must not exist in reactor root
}
catch( Throwable t )
{
t.printStackTrace();
System.out.println( "FAILED!" );
return false;
}

System.out.println( "FAILED!" );
return false;
return true;
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ else if ( project.getScm().getConnection() != null )
String projectId =
ArtifactUtils.versionlessKey( reactorProject.getGroupId(), reactorProject.getArtifactId() );

descriptor.addOriginalScmInfo( projectId, buildScm( project ) );
descriptor.addOriginalScmInfo( projectId, buildScm( reactorProject ) );
}
}

Expand Down

0 comments on commit 38939c3

Please sign in to comment.