Skip to content

Commit 83deb62

Browse files
committed
[MRELEASE-1104] fix stage goal when having both arguments and stagingRepository
Signed-off-by: Olivier Lamy <olamy@apache.org>
1 parent bce380b commit 83deb62

File tree

12 files changed

+218
-1
lines changed

12 files changed

+218
-1
lines changed

maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ public void perform( ReleasePerformRequest performRequest )
322322
private void perform( ReleasePerformRequest performRequest, ReleaseResult result )
323323
throws ReleaseExecutionException, ReleaseFailureException
324324
{
325+
326+
// https://issues.apache.org/jira/browse/MRELEASE-1104 because stageRepository is an additional arg
327+
// and only adding at perform stage it's not available during prepare and so not save the not available
328+
// when reloading. save this then change again after load
329+
String additionalArguments = performRequest.getReleaseDescriptorBuilder().build().getAdditionalArguments();
330+
325331
List<String> specificProfiles =
326332
ReleaseUtils.buildReleaseDescriptor( performRequest.getReleaseDescriptorBuilder() )
327333
.getActivateProfiles();
@@ -330,6 +336,9 @@ private void perform( ReleasePerformRequest performRequest, ReleaseResult result
330336
loadReleaseDescriptorBuilder( performRequest.getReleaseDescriptorBuilder(),
331337
performRequest.getReleaseManagerListener() );
332338

339+
340+
builder.setAdditionalArguments( additionalArguments );
341+
333342
if ( specificProfiles != null && !specificProfiles.isEmpty() )
334343
{
335344
List<String> allProfiles =

maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public void executeGoals( File workingDirectory, List<String> goals, ReleaseEnvi
110110

111111
cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );
112112

113+
// FIX for MRELEASE-1105
114+
//cl.addEnvironment( "MAVEN_DEBUG_OPTS", "" );
115+
113116
cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
114117

115118
if ( settingsFile != null )

maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public void executeGoals( File workingDirectory, List<String> goals, ReleaseEnvi
7272
InvocationRequest req = new DefaultInvocationRequest()
7373
.setDebug( getLogger().isDebugEnabled() )
7474
.setBaseDirectory( workingDirectory )
75+
// fix for MRELEASE-1105
76+
//.addShellEnvironment( "MAVEN_DEBUG_OPTS", "" )
7577
.setBatchMode( true )
7678
.setOutputHandler( getLogger()::info )
7779
.setErrorHandler( getLogger()::error );

maven-release-plugin/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
<pomInclude>projects/branch/*/pom.xml</pomInclude>
224224
<pomInclude>projects/perform/*/pom.xml</pomInclude>
225225
<pomInclude>projects/update-versions/*/pom.xml</pomInclude>
226+
<pomInclude>projects/stage/*/pom.xml</pomInclude>
226227
</pomIncludes>
227228
<pomExcludes>
228229
<pomExclude>projects/prepare/MRELEASE-966/pom.xml</pomExclude>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = clean release:prepare release:stage -X
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
23+
<groupId>org.apache.maven.plugin.release.its</groupId>
24+
<artifactId>mrelease-1104-both-parameters</artifactId>
25+
<version>1.0-SNAPSHOT</version>
26+
27+
<scm>
28+
<connection>scm:dummy|nul</connection>
29+
<developerConnection>scm:dummy|nul</developerConnection>
30+
</scm>
31+
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-release-plugin</artifactId>
37+
<version>@project.version@</version>
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.apache.maven.its.release</groupId>
41+
<artifactId>maven-scm-provider-dummy</artifactId>
42+
<version>1.0</version>
43+
</dependency>
44+
</dependencies>
45+
<configuration>
46+
<arguments>-DskipTests</arguments>
47+
<stagingRepository>file://${project.build.directory}/dummy/staging</stagingRepository>
48+
</configuration>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
File buildLog = new File( basedir, 'build.log' )
21+
assert buildLog.exists()
22+
23+
assert buildLog.text.contains( "with additional arguments: -DskipTests -DaltDeploymentRepository=\"file://" )
24+
25+
26+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = clean release:prepare release:stage -X
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
23+
<groupId>org.apache.maven.plugin.release.its</groupId>
24+
<artifactId>mrelease-1104-stage-repo-only</artifactId>
25+
<version>1.0-SNAPSHOT</version>
26+
27+
<scm>
28+
<connection>scm:dummy|nul</connection>
29+
<developerConnection>scm:dummy|nul</developerConnection>
30+
</scm>
31+
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-release-plugin</artifactId>
37+
<version>@project.version@</version>
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.apache.maven.its.release</groupId>
41+
<artifactId>maven-scm-provider-dummy</artifactId>
42+
<version>1.0</version>
43+
</dependency>
44+
</dependencies>
45+
<configuration>
46+
<stagingRepository>file://${project.build.directory}/dummy/staging</stagingRepository>
47+
</configuration>
48+
</plugin>
49+
</plugins>
50+
</build>
51+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
File buildLog = new File( basedir, 'build.log' )
21+
assert buildLog.exists()
22+
23+
assert buildLog.text.contains( "with additional arguments: -DaltDeploymentRepository=\"file://" )
24+
25+
26+

0 commit comments

Comments
 (0)