cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Using Maven Release Plugin with Source Integrity

Highlighted
Newbie

Using Maven Release Plugin with Source Integrity

Hello,

 

I tried to use the Maven Release Plugin together with source integrity.

I currently have 2 problems while using it:

 

1.

This plugin performs the following steps if executing the goal 

mvn release:prepare
  • Check that there are no uncommitted changes in the sources
  • Check that there are no SNAPSHOT dependencies
  • Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
  • Transform the SCM information in the POM to include the final destination of the tag
  • Run the project tests against the modified POMs to confirm everything is in working order
  • Commit the modified POMs
  • Tag the code in the SCM with a version name (this will be prompted for)
  • Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
  • Commit the modified POMs

This works fine up until the point where the pom.xml should be bumped to the new version y-SNAPSHOT.

 

As far as I can see the file is checked-in/committed before the modification is done. This causes the file to be read-only, which by consequence prevents maven to modify the file and abort the build (blocking point for using the plugin, e.g. in continuous integration environments).

 

2.

It seems that the following characters are not allowed to be used for a checkpoint label: 

$ , . : ; / \ @

 

Another real blocking-point, as it is usual to provide the version number of a project in the label. Maven has the version numbers in the following format: major.minor

 

From my analysis it is the SCM Provider implementation that should be adapted. I checked the sources here. Maybe the implementation could replace the dot in the version number with an underscore, hyphen or similar. It would be even better to be able to specify a system property (like for the Change-Package-Id) with e.g.:

 

-Dmaven.scm.integrity.versiondelimiter="-"

 

Has someone worked with the release plugin before and could possibly provide a solution?

 

The contact person mentioned in the SCM implementation is Cletus D'Souza (I did not write an email to him as the mentioned address uses @Mks.com and I am not sure if this is still valid).

 

Thank you already for any help!

 

Attention: switching off read-only for check-in operations on the server for all projects is not an option.

2 REPLIES 2

Re: Using Maven Release Plugin with Source Integrity

 

For the second problem, the Project.java checks for the invalid characters in the label.  

 

    public static void validateTag( String tagName )
        throws Exception
    {
        if ( tagName == null || tagName.length() == 0 )
        {
            throw new Exception( "The checkpoint label string is empty!" );
        }

        char ch = tagName.charAt( 0 );
        if ( !( ( 'A' <= ch && ch <= 'Z' ) || ( 'a' <= ch && ch <= 'z' ) ) )
        {
            throw new Exception( "The checkpoint label must start with an alpha character!" );
        }

        for ( char invalid : "$,.:;/\\@".toCharArray() )
        {
            if ( tagName.indexOf( invalid ) >= 0 )
            {
                throw new Exception(
                    "The checkpoint label may cannot contain one of the following characters: $ , . : ; / \\ @" );
            }
        }
    }

You can modify the code to remove the period (.) as a restricted character. A label can contain a period; it just can't look like a revision number.  So label "1.2" would fail, but "Project 1.3" would be fine. 

 

 

Re: Using Maven Release Plugin with Source Integrity

For the first problem, it's possible to keep a working file always writable by setting the "writable" attribute. 

 

To add the writable attribute to a member:

  • Select the member and go to Member > Views > View Information
  • Under the Attributes tab, create a variable named writable (case sensitive) with no value and click Add
  • For CLI: si addmemberattr --attr=writable <file>

The working file will be writable the next time it is checked out, and will stay writable on check in. To force the working file to be writable immediately, you can use Members > Make Working File Writable or the si makewritable command in the sandbox. 

 

CS227477 has more details.