diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java index 199dc7fd1..3ad03bd7f 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java @@ -322,6 +322,12 @@ public void perform( ReleasePerformRequest performRequest ) private void perform( ReleasePerformRequest performRequest, ReleaseResult result ) throws ReleaseExecutionException, ReleaseFailureException { + + // https://issues.apache.org/jira/browse/MRELEASE-1104 because stageRepository is an additional arg + // and only adding at perform stage it's not available during prepare and so not save the not available + // when reloading. save this then change again after load + String additionalArguments = performRequest.getReleaseDescriptorBuilder().build().getAdditionalArguments(); + List specificProfiles = ReleaseUtils.buildReleaseDescriptor( performRequest.getReleaseDescriptorBuilder() ) .getActivateProfiles(); @@ -330,6 +336,9 @@ private void perform( ReleasePerformRequest performRequest, ReleaseResult result loadReleaseDescriptorBuilder( performRequest.getReleaseDescriptorBuilder(), performRequest.getReleaseManagerListener() ); + + builder.setAdditionalArguments( additionalArguments ); + if ( specificProfiles != null && !specificProfiles.isEmpty() ) { List allProfiles = diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java index 463486d3a..1c5c36209 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/ForkedMavenExecutor.java @@ -110,6 +110,9 @@ public void executeGoals( File workingDirectory, List goals, ReleaseEnvi cl.setWorkingDirectory( workingDirectory.getAbsolutePath() ); + // FIX for MRELEASE-1105 + //cl.addEnvironment( "MAVEN_DEBUG_OPTS", "" ); + cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" ); if ( settingsFile != null ) diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java index 1eda20959..972cbc675 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/exec/InvokerMavenExecutor.java @@ -72,6 +72,8 @@ public void executeGoals( File workingDirectory, List goals, ReleaseEnvi InvocationRequest req = new DefaultInvocationRequest() .setDebug( getLogger().isDebugEnabled() ) .setBaseDirectory( workingDirectory ) + // fix for MRELEASE-1105 + //.addShellEnvironment( "MAVEN_DEBUG_OPTS", "" ) .setBatchMode( true ) .setOutputHandler( getLogger()::info ) .setErrorHandler( getLogger()::error ); diff --git a/maven-release-plugin/pom.xml b/maven-release-plugin/pom.xml index 8c7702e9d..db25a4296 100644 --- a/maven-release-plugin/pom.xml +++ b/maven-release-plugin/pom.xml @@ -223,6 +223,7 @@ projects/branch/*/pom.xml projects/perform/*/pom.xml projects/update-versions/*/pom.xml + projects/stage/*/pom.xml projects/prepare/MRELEASE-966/pom.xml diff --git a/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/invoker.properties b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/invoker.properties new file mode 100644 index 000000000..a5c864ac9 --- /dev/null +++ b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/invoker.properties @@ -0,0 +1,18 @@ +# 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. + +invoker.goals = clean release:prepare release:stage -X \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/pom.xml b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/pom.xml new file mode 100644 index 000000000..0bbd41466 --- /dev/null +++ b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-1104-both-parameters + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + -DskipTests + file://${project.build.directory}/dummy/staging + + + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/verify.groovy b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/verify.groovy new file mode 100644 index 000000000..d0950f130 --- /dev/null +++ b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-both-parameters/verify.groovy @@ -0,0 +1,26 @@ +/* + * 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. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.text.contains( "with additional arguments: -DskipTests -DaltDeploymentRepository=\"file://" ) + + + diff --git a/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/invoker.properties b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/invoker.properties new file mode 100644 index 000000000..a5c864ac9 --- /dev/null +++ b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/invoker.properties @@ -0,0 +1,18 @@ +# 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. + +invoker.goals = clean release:prepare release:stage -X \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/pom.xml b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/pom.xml new file mode 100644 index 000000000..812a62ed7 --- /dev/null +++ b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + org.apache.maven.plugin.release.its + mrelease-1104-stage-repo-only + 1.0-SNAPSHOT + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + file://${project.build.directory}/dummy/staging + + + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/verify.groovy b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/verify.groovy new file mode 100644 index 000000000..930fef4ae --- /dev/null +++ b/maven-release-plugin/src/it/projects/stage/MRELEASE-1104-stage-repo-only/verify.groovy @@ -0,0 +1,26 @@ +/* + * 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. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert buildLog.text.contains( "with additional arguments: -DaltDeploymentRepository=\"file://" ) + + + diff --git a/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java b/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java index a4c6ebbbe..e16b52225 100644 --- a/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java +++ b/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/StageReleaseMojoTest.java @@ -88,6 +88,16 @@ public void testCreateGoals() assertEquals( "deploy site:stage-deploy", mojo.goals ); } + public void testCreateArguments() + throws Exception + { + StageReleaseMojo mojo = getMojoWithProjectSite( "stage.xml" ); + mojo.setDeploymentRepository(); + ReleaseDescriptorBuilder.BuilderReleaseDescriptor releaseDescriptor = mojo.createReleaseDescriptor().build(); + assertEquals( "-DskipTests -DaltDeploymentRepository=\"staging\"", releaseDescriptor.getAdditionalArguments() ); + } + + private StageReleaseMojo getMojoWithProjectSite( String fileName ) throws Exception { diff --git a/maven-release-plugin/src/test/resources/mojos/stage/stage.xml b/maven-release-plugin/src/test/resources/mojos/stage/stage.xml index d1ac5835e..ee865b245 100644 --- a/maven-release-plugin/src/test/resources/mojos/stage/stage.xml +++ b/maven-release-plugin/src/test/resources/mojos/stage/stage.xml @@ -31,7 +31,8 @@ ${basedir}/target/checkout staging - deploy site-deploy + deploy site-deploy + -DskipTests true