It's all about the answers!

Ask a question

How to get Maven release plugin 3.0.0-M1 to work with RTC 6.0.6.1?


Michael GHyde (5014) | asked Jul 05 '20, 9:59 p.m.

I cannot get the Maven release plugin 3.0.0-M1 to work with RTC 6.0.6.1.  My latest attempts involve trying to use:


Cygwin64 on Windows

Maven 3.6.3

Release plugin: 3.0.0-M1 (and thus maven-scm-provider-jazz 1.11.2)

RTC server: 6.0.6.1

RTC scmTools: 6.0.6.1

Artifactory OSS: 7.5.7


I'm working with a built-from-scratch example to try to validate this configuration. My stream is named "DevStream", with a single Component "MavenTests"


In this component is a single Maven pom project name "demo-pom", with:

    artifactId: demo-pom

    version: 1.0.0-SNAPSHOT


I have a personal developer workspace "myWorkspace" that flows to "DevStream"


A second workspace, "MavenTests_buildWorkspace" (referred to below as “buildWorkspace”) is used by Jenkins, it also flows to "DevStream".  RTC polling in Jenkins monitors that workspace and triggers what should be snapshot builds.  Polling is disabled when we're setting up to do a Maven release:prepare and :perform.


QUESTIONS:


1. Can anyone confirm successful use of Maven release plugin 3.0.0-M1 (release:prepare and release:perform goals) with RTC 6.0.6.1? 


If this is known not to work, is there any known Maven release plugin support for RTC 6.0.6.1 ?


2. What, exactly, should the <scm> values in the pom be set to, and pre-configured in RTC, prior to running release:prepare?


Many times I have referred to https://maven.apache.org/scm/maven-scm-providers/maven-scm-provider-jazz/releases.html, and tried to replicate the example, but no success.


That example shows setting <url> <connection> and <developerConnection> values all set to the same workspace, and suggests that the flow target for this workspace should be the development stream.


But it's not clear whether this is just the name for a workspace for the plugin to create, or if it needs to be a pre-existing repository workspace -- such as the one we use for regular Jenkins snapshot builds. 


3. In addition to the workspace references in the <scm> section, which workspace should be loaded into the sandbox, against which the “mvn release:prepare” commands will be run? This is also not clear from the above article.


May I use my standard build workspace?  Or must the loaded workspace be different from the ones specified in <scm> configuration in the pom?


4. I'd like to know the expected outcomes of the release/perform operation as it relates to the RTC repository.  What exactly should be produced, in terms of deliveries, snapshots, and affected workspaces?  


I believe there are workspaces and/or snapshots named "<artifactId>-<version>" that are created as part of this process.  In earlier testing with the 2.5.3 plugin, we saw snapshots and workspaces with “1.0.0” in their name, but their content still had 1.0.0-SNAPSHOT version in the pom file. Haven't gotten this far with the 3.0.0-M1 release plugin yet.


CURRENT ERROR
===============


I load the buildWorkspace (same as the one referenced in the <scm> connections), and run aven with debug ( -X ) and the release:prepare goal.  It fails on a create snapshot.


Below are the “cmd” outputs I pulled from the output. The failure occurs after prepare has converted the pom version to “1.0.0”, and has delivered that pom.xml change to the stream of the workspace loaded in the sandbox.


FYI, I did try making a copy of the buildWorkspace and loading that into my sandbox against which to run Maven, but the same errors occurs.  I’m stuck. 


(Below is grepped “cmd”s from the debug output, follwed by the error.


     1  [INFO] Executing: cmd.exe /X /C "scm status --username jenkins --password ** --wide"

     2  [DEBUG] Executing: cmd.exe /X /C "C:\devtools\apache-maven\apache-maven-3.6.3\bin\mvn.cmd -B -X -D maven.repo.local=C:\Users\example.m2\repository -s C:\cygwin64\tmp\release-settings1348599406974047413.xml clean verify"

     3  [INFO] Executing: cmd.exe /X /C "scm create changeset --username jenkins --password "[maven-release-plugin] prepare release demo-pom-1.0.0""

     4  [INFO] Executing: cmd.exe /X /C "scm status --username jenkins --password ** --wide"

     5  [INFO] Executing: cmd.exe /X /C "scm status --username jenkins --password --wide"

     6  [INFO] Executing: cmd.exe /X /C "scm checkin --username jenkins --password ** C:\M\jenkinslike\load\demo-pom\pom.xml"

     7  [INFO] Executing: cmd.exe /X /C "scm deliver --repository-uri https://rtc.local:9443/ccm --username jenkins --password --source MavenTests_buildWorkspace --target DevStream --overwrite-uncommitted"

     8  [INFO] Executing: cmd.exe /X /C "scm status --username jenkins --password ** --wide"

     9  [INFO] Executing: cmd.exe /X /C "scm create snapshot --repository-uri https://rtc.local:9443/ccm --username jenkins --password --name demo-pom-1.0.0 --description "[maven-release-plugin] copy for tag demo-pom-1.0.0" MavenTests_buildWorkspace"


Debug output excerpt of final two "cmd" runs:

.

.

.

[INFO] Executing: cmd.exe /X /C "scm status --username jenkins --password * --wide"

[INFO] Working directory: C:\M\jenkinslike\load\demo-pom

[DEBUG] Consumed line :Workspace: (3769) "MavenTests_buildWorkspace" <-> (3762) "DevStream"

[DEBUG] Successfully parsed "Workspace:" line:

[DEBUG]   workspaceAlias = 3769

[DEBUG]   workspace      = MavenTests_buildWorkspace

[DEBUG]   streamAlias    = 3762

[DEBUG]   stream         = DevStream

[DEBUG] Consumed line :  Component: (3764) "MavenTests"

[DEBUG] Successfully parsed "Component:" line:

[DEBUG]   componentAlias = 3764

[DEBUG]   component      = MavenTests

[DEBUG] Consumed line :    Baseline: (3770) 2 "MavenTests_#7"

[DEBUG] Successfully parsed "Baseline:" line:

[DEBUG]   baselineAlias  = 3770

[DEBUG]   baselineId     = 2

[DEBUG]   baseline       = MavenTests_#7

[DEBUG] Consumed line :    Unresolved:

[DEBUG] Consumed line :      a-- /demo-pom/pom.xml.releaseBackup

[DEBUG]  Extracted filePath  : '/demo-pom/pom.xml.releaseBackup'

[DEBUG]  Extracted     flag  : 'a-'

[DEBUG]  Extracted   status  : 'added'

[DEBUG] Consumed line :      a-- /demo-pom/release.properties

[DEBUG]  Extracted filePath  : '/demo-pom/release.properties'

[DEBUG]  Extracted     flag  : 'a-'

[DEBUG]  Extracted   status  : 'added'

[DEBUG] Iterating over "Status" results

[DEBUG] /demo-pom/pom.xml.releaseBackup : added

[DEBUG] /demo-pom/release.properties : added

[DEBUG] Executing tag command...

[DEBUG] Creating Snapshot...

[INFO] Executing: cmd.exe /X /C "scm create snapshot --repository-uri https://rtc.local:9443/ccm --username jenkins --password ** --name demo-pom-1.0.0 --description "[maven-release-plugin] copy for tag demo-pom-1.0.0" MavenTests_buildWorkspace"

[INFO] Working directory: C:\M\jenkinslike\load\demo-pom

[DEBUG] ErrorConsumer.consumeLine: Problem running 'create snapshot':

[DEBUG] ErrorConsumer.consumeLine: There are 2 items that are not checked in. Check-in the changes or rerun with --overwrite-uncommitted.

[ERROR] Error: Problem running 'create snapshot':

There are 2 items that are not checked in. Check-in the changes or rerun with --overwrite-uncommitted.


[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  01:12 min

[INFO] Finished at: 2020-07-05T19:37:35-04:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare (default-cli) on project demo-pom: Unable to tag SCM

[ERROR] Provider message:

[ERROR] Error code for Jazz SCM tag (SNAPSHOT) command - 34

[ERROR] Command output:

[ERROR] Problem running 'create snapshot':

[ERROR] There are 2 items that are not checked in. Check-in the changes or rerun with --overwrite-uncommitted.

.

.

.

<end of excerpt>

Suggestions?

One answer



permanent link
Michael GHyde (5014) | answered Jul 19 '20, 10:24 p.m.

Regarding this particular blocking issue:

[DEBUG] ErrorConsumer.consumeLine: There are 2 items that are not checked in. Check-in the changes or rerun with --overwrite-uncommitted.
    
If anyone gets the above, a workaround was discovered.

First, answers to the above:
  1. Yes, we found a repeatable solution using 6.0.6.1 and maven-release-plugin 3.0.0-M1.
  2. I needed the workspace identified by <developerConnection> to be an existing workspace, e.g. my "buildWorkspace".
  3. This buildWorkspace is also what I explicitly loaded into the sandbox, against which the maven-release-plugin was run.
  4. Outcomes were as follows, supposing starting version of "1.1.17-SNAPSHOT":
    1. A baseline with "tagName" created according the tagFormat whose default is "@{project.artifactId}-@{project.version}" ) is created on the component containing the project, e.g. a new baseline named: "demo-pom-1.1.17" was created on the component.
      The contents of this baseline include the pom.xml modified with <version> being the release version, e.g. "1.1.17",
      and whose <scm> section in this same pom.xml has all three properties set to the "tagName" value e.g
          <connection>demo-pom-1.1.17</connection
          <developerConnection>demo-pom-1.1.17</developerConnection>
          <u
      rl>demo-pom-1.1.17</url>
    2. The above component baseline will consist of two change sets, the first using the "tagName" in the comment:
      [maven-release-plugin] prepare release demo-pom-1.1.17
      - [maven-release-plugin] prepare for next development iteration
    3. A new RTC workspace is created, named after the "tagName", e.g. "demo-pom-1.1.17", with contents being the above component baseline.
    4. The stream to which buildWorkspace flows receive a similar snapshot name "tagName" for the contents with the release version pom:
      Snapshot Name: demo-pom-1.1.17
      Description:  "[maven-release-plugin] copy for tag demo-pom-1.1.17" 
    5. The stream contents also receive the final delivery from release:perform, being <version> set to the next incremental SNAPSHOT value for the pom file, 1.1.18-SNAPSHOT".
      Also note the <scm> values return to their original settings as per the 1.1.17-SNAPSHOT version.
Here is the unblocking discovery that enabled "mvn release:prepare release:perform" work:

One must set RTC to explictly ignore these two maven-produced files:
    pom.xml.releaseBackup
release.properties
I.e. add these two files to your .jazzignore file.  We placed these two files in the core.ignore property inside .jazzignore to look like this:
    core.ignore= \
{pom.xml.releaseBackup} \
{release.properties}
With this in place, a release:prepare and release:perform Maven goals were able to work in an invocation like this (as mentioned at the end of the maven-scm-provider-jazz page):
mvn -B -Dresume=false -DworkingDirectory=/tmp/maven release:prepare release:perform
        
Hope this helps you.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.