Skip to content

Commit

Permalink
[MRELEASE-1089] Reduce the tag format to the project version only
Browse files Browse the repository at this point in the history
This closes #122
  • Loading branch information
michael-o committed May 7, 2022
1 parent 8cc2f45 commit 428afac
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ assert 1 == pomXml.getText().count("<developerConnection>scm:svn:http://\${scm.h

File pomXmlTag = new File( basedir, 'pom.xml.tag' )
assert pomXmlTag.exists()
assert 1 == pomXmlTag.getText().count("<connection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/tags/mrelease-128-1.0</connection>")
assert 1 == pomXmlTag.getText().count("<developerConnection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/tags/mrelease-128-1.0</developerConnection>")
assert 1 == pomXmlTag.getText().count("<connection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/tags/1.0</connection>")
assert 1 == pomXmlTag.getText().count("<developerConnection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/tags/1.0</developerConnection>")

File pomXmlNext = new File( basedir, 'pom.xml.next' )
assert pomXmlNext.exists()
Expand All @@ -36,4 +36,4 @@ assert 1 == pomXmlNext.getText().count("<developerConnection>scm:svn:http://\${s
File pomXmlReleaseBackup = new File( basedir, 'pom.xml.releaseBackup' )
assert pomXmlReleaseBackup.exists()
assert 1 == pomXmlReleaseBackup.getText().count("<connection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/</connection>")
assert 1 == pomXmlReleaseBackup.getText().count("<developerConnection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/</developerConnection>")
assert 1 == pomXmlReleaseBackup.getText().count("<developerConnection>scm:svn:http://\${scm.host}/svn/\${project.artifactId}/trunk/</developerConnection>")
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<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/parent-project</connection>
<connection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/parent-project</connection>
<developerConnection>scm:svn:file://localhost/${project.file.parentFile.parentFile}/target/svnroot/flat-multi-module/trunk/parent-project</developerConnection>
</scm>

Expand All @@ -42,6 +42,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<tagNameFormat>@{project.artifactId}-@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ try
String contents = data.toString();

String expected1 = "Full run would tag working copy '" + basedir + "'";
String expected2 = " with label 'regular-multi-module-project-1.0'";
String expected2 = " with label '1.0'";

if( contents.indexOf( expected1 ) != -1 && contents.indexOf( expected2 ) != -1 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public abstract class AbstractScmReleaseMojo
*
* @since 2.2.0
*/
@Parameter( defaultValue = "@{project.artifactId}-@{project.version}", property = "tagNameFormat" )
@Parameter( defaultValue = "@{project.version}", property = "tagNameFormat" )
private String tagNameFormat;

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ public abstract class AbstractScmReleaseMojo
private String workItem;

/**
* Add a new or overwrite the default implementation per provider.
* Add a new or overwrite the default implementation per provider.
* The key is the scm prefix and the value is the role hint of the
* {@link org.apache.maven.scm.provider.ScmProvider}.
*
Expand Down Expand Up @@ -159,7 +159,7 @@ protected ReleaseDescriptorBuilder createReleaseDescriptor()

descriptor.setPushChanges( pushChanges );
descriptor.setWorkItem( workItem );

if ( project.getScm() != null )
{
if ( project.getScm().getDeveloperConnection() != null )
Expand All @@ -171,24 +171,24 @@ else if ( project.getScm().getConnection() != null )
descriptor.setScmSourceUrl( project.getScm().getConnection() );
}
}

// As long as Scm.getId() does not exist, read it as a property
descriptor.setScmId( project.getProperties().getProperty( "project.scm.id" ) );

for ( MavenProject reactorProject : session.getProjects() )
{
if ( reactorProject.getScm() != null )
{
String projectId =
ArtifactUtils.versionlessKey( reactorProject.getGroupId(), reactorProject.getArtifactId() );

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

return descriptor;
}

/**
* <p>buildScm.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ mvn release:prepare-with-pom

* Overriding the default tag name format

By default, if you do not specify a tag name, a default tag name of <<<artifactId>>>-<<<version>>> will be
By default, if you do not specify a tag name, a default tag name of <<<version>>> will be
suggested (and if running non-interactively used).

You can specify the exact tag name to use from the command line by passing the <<<tag>>> property, but if you
Expand Down Expand Up @@ -141,4 +141,4 @@ mvn release:prepare-with-pom

[]

The <<<project.>>> prefix is optional and may be omitted.
The <<<project.>>> prefix is optional and may be omitted.

0 comments on commit 428afac

Please sign in to comment.