Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRELEASE-839]: Unable to supply tag to release for release:perform #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 = release:clean release:perform
47 changes: 47 additions & 0 deletions maven-release-plugin/src/it/projects/perform/MRELEASE-839/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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">
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.plugin.release.its</groupId>
<artifactId>mrelease-832</artifactId>
<version>1.0-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>@project.version@</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.release</groupId>
<artifactId>maven-scm-provider-dummy</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<configuration>
<connectionUrl>scm:dummy|nul</connectionUrl>
<tag>test-tag</tag>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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( "[DEBUG] (f) tag = test-tag" )

Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
@Mojo( name = "perform", aggregator = true, requiresProject = false )
public class PerformReleaseMojo
extends AbstractReleaseMojo
extends AbstractScmReleaseMojo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #145 (comment). This exposes a lot more unused parameters, not just tag

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwin I see your point. What's the best course of action? Wait for 145 to be resolved, implement the changes suggested by 145, or just add tag property to perform release mojo?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michael-o Please advise how to continue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kwin I see you commented on #145 to create 2 separate classes. I believe if they are created, this pull request may be made redundant

{
/**
* A space separated list of goals to execute on release perform. Default value is either <code>deploy</code> or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public class PerformReleaseMojoTest
{
private File workingDirectory;

private static void assertTag(ArgumentCaptor<ReleasePerformRequest> argument) {
assertEquals( "test-tag", argument.getValue().getReleaseDescriptorBuilder().
build().getScmReleaseLabel() );
}

public void testPerform()
throws Exception
{
Expand All @@ -67,7 +72,7 @@ public void testPerform()

ReleaseManager mock = mock( ReleaseManager.class );
mojo.setReleaseManager( mock );

// execute
mojo.execute();

Expand All @@ -78,6 +83,8 @@ public void testPerform()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertNotNull( argument.getValue().getReleaseDescriptorBuilder() );
assertTag( argument );
verifyNoMoreInteractions( mock );
}

Expand All @@ -86,6 +93,9 @@ public void testPerformWithFlatStructure()
{
PerformReleaseMojo mojo = getMojoWithProjectSite( "perform-with-flat-structure.xml" );

MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
setVariableValueToObject( mojo, "session", newMavenSession( project ) );

ReleaseDescriptorBuilder builder = createReleaseDescriptorBuilder( mojo );
builder.setWorkingDirectory( workingDirectory.getAbsolutePath() );
File checkoutDirectory = getTestFile( "target/checkout" );
Expand All @@ -106,6 +116,7 @@ public void testPerformWithFlatStructure()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );
verifyNoMoreInteractions( mock );
}

Expand Down Expand Up @@ -141,6 +152,7 @@ public void testPerformWithoutSite()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );
verifyNoMoreInteractions( mock );
}

Expand Down Expand Up @@ -195,6 +207,7 @@ public void testPerformWithExecutionException()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );

verifyNoMoreInteractions( mock );
}
Expand Down Expand Up @@ -235,6 +248,7 @@ public void testPerformWithExecutionFailure()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );

verifyNoMoreInteractions( mock );
}
Expand Down Expand Up @@ -264,6 +278,7 @@ public void testPerformWithScm()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );

verifyNoMoreInteractions( mock );
}
Expand Down Expand Up @@ -302,6 +317,7 @@ public void testPerformWithProfiles()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );

verifyNoMoreInteractions( mock );
}
Expand Down Expand Up @@ -340,6 +356,7 @@ public void testPerformWithProfilesAndArguments()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );

verifyNoMoreInteractions( mock );
}
Expand Down Expand Up @@ -368,6 +385,7 @@ public void testPerformWithMultilineGoals()
assertNotNull( argument.getValue().getReleaseEnvironment() );
assertNotNull( argument.getValue().getReactorProjects() );
assertEquals( Boolean.FALSE, argument.getValue().getDryRun() );
assertTag( argument );

verifyNoMoreInteractions( mock );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.Scm;

/**
* <p>Stub for a MavenProject with a flat structure.</p>
Expand All @@ -39,7 +38,7 @@
* @noinspection ClassNameSameAsAncestorName
*/
public class FlatMultiModuleMavenProjectStub
extends org.apache.maven.plugin.testing.stubs.MavenProjectStub
extends MavenProjectStub
{
public void setDistributionManagement( DistributionManagement distributionManagement )
{
Expand Down Expand Up @@ -77,14 +76,6 @@ public File getBasedir()
return new File( "/flat-multi-module/root-project" ).getAbsoluteFile();
}

public Scm getScm()
{
Scm scm = new Scm();
scm.setConnection( "scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project" );

return scm;
}

@Override
public String getGroupId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.Scm;

/**
* <p>Stub for MavenProject.</p>
Expand Down Expand Up @@ -49,6 +50,26 @@ public Model getModel()
return model;
}

public Scm getScm()
{
Scm scm = new Scm();
scm.setConnection( "scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project" );

return scm;
}

public Model getOriginalModel() {
Model model = super.getOriginalModel();

if (model == null) {
model = new Model();
model.setScm(getScm());
setOriginalModel(model);
}

return model;
}

public DistributionManagement getDistributionManagement()
{
return getModel().getDistributionManagement();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</reactorProjects>
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<useReleaseProfile>true</useReleaseProfile>
<tag>test-tag</tag>
<goals>deploy site-deploy</goals>
<arguments>-Dmaven.test.skip=true</arguments>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</reactorProjects>
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<useReleaseProfile>true</useReleaseProfile>
<tag>test-tag</tag>
<connectionUrl>scm:svn:file://localhost/target/svnroot/flat-multi-module/trunk/root-project</connectionUrl>
<goals>deploy</goals>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</reactorProjects>
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<useReleaseProfile>true</useReleaseProfile>
<tag>test-tag</tag>
<goals>
deploy
site-deploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</reactorProjects>
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<useReleaseProfile>true</useReleaseProfile>
<tag>test-tag</tag>
<connectionUrl>scm-url</connectionUrl>
<goals>deploy site-deploy</goals>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<goals>deploy</goals>
<useReleaseProfile>true</useReleaseProfile>
<tag>test-tag</tag>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<workingDirectory>${basedir}/target/checkout</workingDirectory>
<goals>deploy site-deploy</goals>
<useReleaseProfile>true</useReleaseProfile>
<tag>test-tag</tag>
</configuration>
</plugin>
</plugins>
Expand Down