Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Any clear step by step example of how to use the maven-release-plugin with the Jazz SCM provider?

I have been trying to evaluate the value of maven release plugin along with the Jazz SCM provider.  As post
https://jazz.net/forum/questions/136583/how-do-i-run-maven-releaseperform-with-rtc
indicates, resources:
http://maven.apache.org/scm/maven-scm-providers/maven-scm-provider-jazz/ and
https://jazz.net/forum/questions/39653/maven-scm-plugin-for-rtc?sort=votes&page=10 as well as others are confusing and at best incomplete.  I have been having a rather difficult time with this.   The command:

mvn -B -Dresume=false -DworkingDirectory=/directory release:prepare release:perform

hangs and nor does it alter the working directory.  Jazz indicates the working directory is defined as the location I have executed maven.

So the question.  Is there a fully explained example of how to use the Maven release plugin including pom file, set up, settings file, set my step command lines, eclipse support if possible etc.  ??   Otherwise I am not sure how anyone can use this in its currently documented form.

There are a lot of unanswered posts like

https://jazz.net/forum/questions/164161/hi-i-am-using-rtc-401-and-i-am-trying-to-use-the-scm-jazz-provider-in-my-maven-release-plugin-but-some-how-its-not-taking-my-scm-url-for-connection

so hopefully this one will get answered.

Thanks

0 votes



7 answers

Permanent link
Hi David. Please see the "Working with the Release Plugin" on the Jazz SCM provider's doc page at http://maven.apache.org/scm/maven-scm-providers/maven-scm-provider-jazz/

Note that it has: -DworkingDirectory=/tmp/maven
This is needed as a workaround since the release plugin does a checkout, but Jazz SCM doesn't like nested sandbox directories, so this places the release's checkout sandbox under the temp dir instead.

0 votes

Comments

 Yes I have read this article - several times and have -DworkingDirectory set to /tmp/maven.  The command hangs and there is nothing in /tmp/maven/  I have simple parent/child code examples that are flat and another that is nested - same result.

If it's hanging, this should be reported as a bug.  Which version of RTC are you using? Does it hang in Maven (before launching the SCM CLI) or during the launch of the SCM CLI? Can you send a kill 3 to the java process(es) to get stack dumps? 

I have created a PMR - 12232,7TD,000 and I will add more to it later today.  I am using RTC 5.0.0 on Windows 7 , server and client.  I am also using Maven 3.2.3.  There is no Jazz engine involved - I am executing locally on my Windows 7 client machine.

The -DworkingDirectory=blah can point to anywhere, so long as it does not point to within the same sandbox. This is due to the jazz restruction of no nested sandboxes (that may have been lifted now).

Simple, from your project, make a dir, cd to it and do a scm load, if it does not allow nested sandboxes, then it will fail.


Permanent link
 So I have gotten the nested version to work and now I am movning nto the flattened version I think the initial problem was the id of the repository in the <server> section of the settings.xml file had https:// in it and I was not authenticating correctly.  Now the problem moves onto work items.  Our process requires work items in order to deliver changes. So how do I do this in the context of the maven release plugin?  Is there a way to pass in a work item on the command line?  Another question is how do I specify specifically the version I want to have set instead of the default incremental counter?

0 votes

Comments

Are you saying that with 'https://' in the <server> section that it was hanging, or did it fail with a connection or auth error? 

 I executed this in a Windows command line.   I looked like it was was waiting for something.  There was no authentication error.  Eventually I Ctrl-C'd the process.

Don't flatten it, leave it as nested. If you're on 5.0.2, you'll have a version of eclipse that can cope with linked projects, so unless you're using WID/IID, you'll be fine.

As for work items. Once I get through the pain of upgrading the DB to 4.0, then I'll be able to address the need to associate work items with changesets.


Permanent link
 [INFO] Executing: cmd.exe /X /C "scm deliver --repository-uri https://us-nj-darn
one.comverse.com:9443/ccm --username darnone --password ***** --source "darnone
- Maven Nested Release Stream Workspace" --target "Maven Nested Release Stream"
--overwrite-uncommitted"
[INFO] Working directory: C:\workspaces\maven_release_nested_workspace\parent
[ERROR] Error: Process Reports:
  Name: Deliver
  Operation Reports:
    Name: Source Control Operation
    Name: Deliver
    Participant Reports:Another question is how do I specify specifically the version I want to have set instead of the default incremental counter?
      Name: Require Work Items and Comments
        A work item must be associated with the change set.
        At least one of the associated work items must be assigned to you.
        At least one of the associated work items must specify that the work is
planned for the current iteration.
Problem running 'deliver':
'Deliver' failed. Preconditions have not been met: A work item must be associate
d with the change set.

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................. FAILURE [01:21 min]
[INFO] module1 ............................................ SKIPPED
[INFO] module2 ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:22 min
[INFO] Finished at: 2015-01-07T11:49:55-05:00
[INFO] Final Memory: 10M/246M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5
.1:prepare (default-cli) on project parent: Unable to commit files
[ERROR] Provider message:
[ERROR] Error code for Jazz SCM deliver command - 17
[ERROR] Command output:
[ERROR] Process Reports:
[ERROR] Name: Deliver

0 votes


Permanent link
 
Below is the output regarding the need for a work item.  Even though I pass -DworkingDirectory=/tmp/maven the output indicates the working directory is my current eclipse workspace.  Deliver fails because of process rules we use and  how would I specify the specific version instead of he default.

[INFO] Executing: cmd.exe /X /C "scm deliver --repository-uri https://us-nj-darn
one.comverse.com:9443/ccm --username darnone --password ***** --source "darnone
- Maven Nested Release Stream Workspace" --target "Maven Nested Release Stream"
--overwrite-uncommitted"
[INFO] Working directory: C:\workspaces\maven_release_nested_workspace\parent
[ERROR] Error: Process Reports:
  Name: Deliver
  Operation Reports:
    Name: Source Control Operation
    Name: Deliver
    Participant Reports:Another question is how do I specify specifically the version I want to have set instead of the default incremental counter?
      Name: Require Work Items and Comments
        A work item must be associated with the change set.
        At least one of the associated work items must be assigned to you.
        At least one of the associated work items must specify that the work is
planned for the current iteration.
Problem running 'deliver':
'Deliver' failed. Preconditions have not been met: A work item must be associate
d with the change set.

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................. FAILURE [01:21 min]
[INFO] module1 ............................................ SKIPPED
[INFO] module2 ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:22 min
[INFO] Finished at: 2015-01-07T11:49:55-05:00
[INFO] Final Memory: 10M/246M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5
.1:prepare (default-cli) on project parent: Unable to commit files
[ERROR] Provider message:
[ERROR] Error code for Jazz SCM deliver command - 17
[ERROR] Command output:
[ERROR] Process Reports:
[ERROR] Name: Deliver

0 votes


Permanent link
The SCM provider doesn't currently allow a work item to be specified. That sounds like a good enhancement, though, since it's pretty common to have that prerequisite configured. For now, you'll probably need to override that process configuration for the user running the release (i.e. you) in the team area that owns the stream, to remove that precondition during the release.

0 votes

Comments

 I have cleaned up my example and have the prepare step working.  I temporarily changed the process to remove the restriction.  It seems strange that the provide doe snot support attaching a work item since work items are central, a release would be something interesting to track, that there is a Track Build Item,etc.  Should I create the enhancement - there are few others I have though of like providing filters on Jenkins jobs in the Hudson/Jenkins Build Definition.


The perform is failing becuase we do not deploy from our poms - we don't use distributionManagent.  Instead we use an ArtifactorPro plugin that provided added benefits like publishing the build of materials to Artifactory which then requests approval of 3rd party dependencies in BlackDuck Code Center.

It is the perform step that uses the temporary directory - clarification on that in the documentation would be helpful and I stand by the original subject of this post that there should be a full example somewhere with a basic scenario for how this works.  Is it possible for outsiders to publish on Jazz.net?

Yes, please go ahead and create the enhancement for allowing a work item to be specified / created. Regarding publishing on jazz.net, the wiki is restricted to developers, but it's possible to publish an article in the jazz.net/library. Could track this in a work item too, with review by someone on the Build team.

 The distributionManagement section of the pom (or settings.xml) is fundamental to the maven release process. release:perform checks out the previous tag (ie what was created in the release:prepare phase) and then spawns a "mvn deploy" on it. This is the standard maven release process and is documented everywhere (there is nothing jazz specific about it, is the point that I'm trying to make here).


 The current snapshot version of both the release plugin and the scm providers now provides the ability to supply a WI to allow the deliver command to work.


Permanent link
Doe the provider support flat projects?  I am trying this now on a flat version of the sample project and I keep getting the error below.  I start off with:

<scm>
<url>https://us-nj-darnone.comverse.com:9443/ccm:darnone - Maven Release Flat Stream Workspace</url>
<connection>scm:jazz:https://us-nj-darnone.comverse.com:9443/ccm:darnone - Maven Release Flat Stream Workspace</connection>
<developerConnection>scm:jazz:https://us-nj-darnone.comverse.com:9443/ccm:darnone - Maven Release Flat Stream Workspace</developerConnection>
</scm> 

and after I run release:prepare I get the below error and the local pom has

<scm>
<url>https://us-nj-darnone.comverse.com:9443/ccm:parent-0.0.1/ccm:darnone - Maven Release Flat Stream Workspace</url>
<connection>scm:jazz:https://us-nj-darnone.comverse.com:9443/ccm:parent-0.0.1/ccm:darnone - Maven Release Flat Stream Workspace</connection>
<developerConnection>scm:jazz:https://us-nj-darnone.comverse.com:9443/ccm:parent-0.0.1/ccm:darnone - Maven Release Flat Stream Workspace</developerConnection>
</scm

Error 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5
.1:prepare (default-cli) on project parent: Jazz Url "https://us-nj-darnone.comv
erse.com" is not a valid URL. The Jazz Url syntax is scm:jazz:[username[;passwor
d]@]http[s]://server_name[:port]/contextRoot:repositoryWorkspace -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

0 votes

Comments

The error here is about the URL, not specifically about the project layout, but I believe the driving release plugin (not our extension to it) may make assumptions about the URL structure based on the project layout.

The pom scm URLs are modified by the prepare process.  The issue is the project structure is flat and something is getting confused.  The solution provided at https://jazz.net/forum/questions/156938/maven-scm-plugin-bug-with-flat-structure

worked but to me this sounds like a bug.

 See below

Don't flatten it. ever.

Why do you wish to do so?

You've got to remember, that maven uses an abstraction layer to represent all SCM operations across all SCM implementations, of which Jazz is one.

It's not a very thing abstraction layer, as it natually represents the history of it's own development, namely cvs -> svn -> git.

Maven does a single checkout for the entire prepare process, using the ONE url from the base pom.xml. Use a nested structure and make sure that everything is under that.

For clarity I recommend that the name in pom.xml is the same as the Jazz Component name - it's clearer. I use the name from the base/root pom to build up the snapshot names.

Sorry, artifactId, not the name.


Permanent link

In response to PMR 12232,7TD,000

https://jazz.net/forum/questions/156938/maven-scm-plugin-bug-with-flat-structure

https://jazz.net/forum/questions/35231/maven-multi-module-projects-in-eclipse

I tried the suggestion in the first link.   Modifying release.properties completedPhase to scm-tag and rerunning the command with -Dresume=true works but the unanswered question of having to change this manually is unanswered int he post.  Is this a bug or an enhancement?

Nick Edgar's reply in the second link was 05/03/2010 so the answer might be dated. The maven-release-plugin has supported flat structures since version 2.5.  Perhaps the implementation for RTC has not caught up?

0 votes

Comments

One thing to mention here is release:prepare when operating on a nested project creates a repository workpsace with the artifact-version format (parent-0.0.3) whereas with a flat project it doesn't do so

So, here you're saying that it works correctly, when nested.
And fails when not.
There's your answer. :) Do not flatten.

The reports about the release plugin working with a flattened structure have been that it's very hit and miss. So your milage will vary. Simply put, I do not recommend it.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 1,202
× 562
× 45

Question asked: Dec 23 '14, 5:53 p.m.

Question was seen: 10,143 times

Last updated: Jul 03 '15, 1:58 a.m.

Confirmation Cancel Confirm