Skip to content

Commit 67dc2f8

Browse files
kwinrfscholte
authored andcommitted
[MRELEASE-1053] scm element removed during release:prepare when parent != reactor root
Signed-off-by: rfscholte <[email protected]>
1 parent 468520a commit 67dc2f8

File tree

7 files changed

+256
-1
lines changed

7 files changed

+256
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<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">
21+
<modelVersion>4.0.0</modelVersion>
22+
<parent>
23+
<groupId>org.apache.maven.plugin.release</groupId>
24+
<artifactId>mrelease-1053-parent</artifactId>
25+
<version>1.0-SNAPSHOT</version>
26+
<relativePath>../module-parent/pom.xml</relativePath>
27+
</parent>
28+
<groupId>org.apache.maven.plugin.release</groupId>
29+
<artifactId>module-a</artifactId>
30+
<version>1.0-SNAPSHOT</version>
31+
<dependencies>
32+
<dependency>
33+
<groupId>junit</groupId>
34+
<artifactId>junit</artifactId>
35+
<version>3.8.1</version>
36+
<scope>test</scope>
37+
</dependency>
38+
</dependencies>
39+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.apache.maven.plugin.release.module.a;
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
/**
23+
* Hello world!
24+
*
25+
*/
26+
public class App
27+
{
28+
public static void main( String[] args )
29+
{
30+
System.out.println( "Hello World!" );
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package org.apache.maven.plugin.release.module.a;
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
import junit.framework.Test;
23+
import junit.framework.TestCase;
24+
import junit.framework.TestSuite;
25+
26+
/**
27+
* Unit test for simple App.
28+
*/
29+
public class AppTest
30+
extends TestCase
31+
{
32+
/**
33+
* Create the test case
34+
*
35+
* @param testName name of the test case
36+
*/
37+
public AppTest( String testName )
38+
{
39+
super( testName );
40+
}
41+
42+
/**
43+
* @return the suite of tests being tested
44+
*/
45+
public static Test suite()
46+
{
47+
return new TestSuite( AppTest.class );
48+
}
49+
50+
/**
51+
* Rigourous Test :-)
52+
*/
53+
public void testApp()
54+
{
55+
assertTrue( true );
56+
}
57+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
<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">
21+
<modelVersion>4.0.0</modelVersion>
22+
<groupId>org.apache.maven.plugin.release</groupId>
23+
<artifactId>mrelease-1053-parent</artifactId>
24+
<packaging>pom</packaging>
25+
<version>1.0-SNAPSHOT</version>
26+
27+
<scm>
28+
<url>http://localhost/myscm/${project.scm.tag}</url>
29+
<connection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/${project.scm.tag}/</connection>
30+
<developerConnection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/${project.scm.tag}/</developerConnection>
31+
<tag>trunk</tag>
32+
</scm>
33+
34+
<properties>
35+
<maven.compiler.source>@maven.compiler.source@</maven.compiler.source>
36+
<maven.compiler.target>@maven.compiler.target@</maven.compiler.target>
37+
</properties>
38+
39+
<build>
40+
<pluginManagement>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.apache.maven.plugins</groupId>
44+
<artifactId>maven-release-plugin</artifactId>
45+
<version>@project.version@</version>
46+
</plugin>
47+
</plugins>
48+
</pluginManagement>
49+
</build>
50+
51+
<dependencies>
52+
<dependency>
53+
<groupId>junit</groupId>
54+
<artifactId>junit</artifactId>
55+
<version>3.8.1</version>
56+
<scope>test</scope>
57+
</dependency>
58+
</dependencies>
59+
</project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
<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">
21+
<modelVersion>4.0.0</modelVersion>
22+
<groupId>org.apache.maven.plugin.release</groupId>
23+
<artifactId>mrelease-1053</artifactId>
24+
<packaging>pom</packaging>
25+
<version>1.0-SNAPSHOT</version>
26+
<url>https://issues.apache.org/jira/browse/MRELEASE-1053</url>
27+
<parent>
28+
<groupId>org.apache.maven.plugin.release</groupId>
29+
<artifactId>mrelease-1053-parent</artifactId>
30+
<relativePath>module-parent/pom.xml</relativePath>
31+
<version>1.0-SNAPSHOT</version>
32+
</parent>
33+
<modules>
34+
<module>module-a</module>
35+
<module>module-parent</module>
36+
</modules>
37+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
// check parent project
21+
def project = new XmlSlurper().parse( new File( new File ( basedir, 'module-parent' ), 'pom.xml.next' ) )
22+
assert project.version.text() == '1.1-SNAPSHOT'
23+
assert project.scm.url.text() == 'http://localhost/myscm/${project.scm.tag}'
24+
25+
// check execution root project
26+
project = new XmlSlurper().parse( new File ( basedir, 'pom.xml.next' ) )
27+
assert 0 == project.scm.size() // scm element must not exist in reactor root
28+
29+
// check module-a project
30+
project = new XmlSlurper().parse( new File( new File ( basedir, 'module-a' ), 'pom.xml.next' ) )
31+
assert 0 == project.scm.size() // scm element must not exist in module

maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ else if ( project.getScm().getConnection() != null )
175175
String projectId =
176176
ArtifactUtils.versionlessKey( reactorProject.getGroupId(), reactorProject.getArtifactId() );
177177

178-
descriptor.addOriginalScmInfo( projectId, buildScm( project ) );
178+
descriptor.addOriginalScmInfo( projectId, buildScm( reactorProject ) );
179179
}
180180
}
181181

0 commit comments

Comments
 (0)