1

Please notice the second question in the end of this one!

I have got some trouble using Jenkins, the maven-release-plugin and integrity (using MKS) as source code Management (scm).

Well, I try to release my project from MKS via Jenkins to Sonartype Nexus. If I use "deploy" as maven goal within the maven-release-plugin, everything is fine and the release is deployed correct, BUT it is saved as a snapshot in Nexus.

To avoid this snapshot problem I decided to use the maven-release-plugin with release:perform. It should change the version number to a version without snapshot (like: 1.0.0), release it and add snapshot to the version number back again when the release was done. Version is increased also (like 1.0.1-SNAPSHOT).

But if I use "release:prepare" or "release:perform" as maven goals the output tells me:

[ERROR] No SCM URL was provided to perform the release from                 
[INFO] ------------------------------------------------------------------------     
[INFO] BUILD FAILURE     
[INFO] ------------------------------------------------------------------------     
[INFO] Total time: 24.405s     
[INFO] Finished at: Fri Feb 14 11:56:40 CET 2014     
[INFO] Final Memory: 10M/245M     
[INFO] ------------------------------------------------------------------------     
Waiting for Jenkins to finish collecting data     
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:perform    (default-cli) on project javatests-test04: No SCM URL was provided to perform the release from -> [Help 1]     
[ERROR]      
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.     
[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 read the following articles:  
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

After I searched a now for a long time but did not found the answer I needed I came up with the idea to open this new question.

I tried things like:

adding information to pom.xml but not even sure if maven realized it (did not know what the correct URL would be for me was or if I even have one so I didn't changed it)

original from this site:

<scm>
   <connection>scm:git:git@github.com:user/project.git</connection>
   <url>scm:git:git@github.com:user/project.git</url>
   <developerConnection>scm:git:git@github.com:user/project.git</developerConnection>
</scm>

my version:

<scm>
   <connection>scm:integrity|myUser@myServer:7001|#p=d:/MKS/Tools/Tools.pj#s=Tests/Tests.pj#javatests-test04 </connection>
   <url>scm:git:git@github.com:user/project.git</url>
   <developerConnection>scm:integrity|myUser@myServer:7001|#p=d:/MKS/Tools/Tools.pj#s=Tests/Tests.pj#javatests-test04</developerConnection>
</scm>

I changed the maven goal as a second try(same with -Dproject.scm.developerConnerction):

release:perform -DconnectionUrl=scm:integrity:myUser@myMksServer:7001|#p=d:/MKS/Tools/Tools.pj#s=Tests/Tests.pj#javatests-test04

but it leads to a new error:     
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.0:prepare
(default-cli) on project javatests-test04: The provider given in the
SCM URL could not be found: No such provider: 'integrity'.

I fact it works fine with "deploy" as maven goal, I am sure this is not the fault of wrong paths to project or to Sonartype Nexus.

Can anybody help me and/or tell me what my Maven goal should be like? Do I have th change things in the pom? in the master pom? I want the release statement work...

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Krummy
  • 658
  • 15
  • 24

2 Answers2

0

EDIT: I FOUND A WORKAROUND! SEE ANSWEAR WITH SOLUTION!

Okay, i have done 1 step in the right direction! Just needed to add a reference into the pom.xml of my project to the currently used maven-release-plugin:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.4.1</version>
            <configuration>
                <checkModificationExcludes>
                    <checkModificationExclude>**/*pom.xml*</checkModificationExclude>
                    <checkModificationExclude>**/*.log</checkModificationExclude>
                    <checkModificationExclude>**/*.jar</checkModificationExclude>
                    <checkModificationExclude>**/target/**</checkModificationExclude>
                </checkModificationExcludes>
            </configuration>
        </plugin>
    </plugins>
</build>

BUT: Now i have some other problems: Console tells me that the login to MKS fails. The called user has got read AND write permissions, path to project and to Jenkins server are set right. I also made sure that the MKS folder is first in my path envionment variables. Just for your information: of course i used a real user with real password and real server and not "myUser", "myPassword" or "myServer" I am pretty sure that i use the right configurations for my scm (developer-)connetction settings, because before the release takes part i download the projects content from MKS to my server with success! No error comes up here...

Usage of "scm:validate" tells me:
[INFO] --- maven-scm-plugin:1.9:validate (default-cli) @ javatests-test04 ---

[INFO] MKS Integrity API Version: 4.10
[INFO] connectionUrl scm connection string is valid.
[INFO] MKS Integrity API Version: 4.10
[INFO] project.scm.connection scm connection string is valid.
[INFO] MKS Integrity API Version: 4.10
[INFO] project.scm.developerConnection scm connection string is valid.

What could be the reason for connections failures?

Console:

[...some more console output...]
Executing Maven:  -B -f (pathToProject)\workspace\pom.xml -DdevelopmentVersion=0.0.5-SNAPSHOT -DreleaseVersion=0.0.4 -Dusername=myUser -Dresume=false compile release:prepare -Dpassword=**********

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building my test project 0.0.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) @ javatests-test04 ---
[some other debug infos]
[DEBUG] -- end configuration --
[DEBUG] User/Password information supplied: myUser/myPasswort
[DEBUG] Host/Port information supplied: myServer:7001
[INFO] MKS Integrity API Version: 4.10
[DEBUG] Configuration Path: #p=d:/MKS/Tools/Tools.pj#s=Tests/Tests.pj#javatests-test04
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **\release.properties, **\pom.xml.next, **\*pom.xml*, **\*.jar, **\pom.xml.releaseBackup, **\pom.xml.backup, **\pom.xml.branch, **\target\**, **\pom.xml.tag, **\*.log
[DEBUG] User/Password information supplied: myUser/myPasswort
[DEBUG] Host/Port information supplied: myServer:7001
[INFO] MKS Integrity API Version: 4.10
[DEBUG] Configuration Path: #p=d:/MKS/Tools/Tools.pj#s=Tests/Tests.pj#javatests-test04
[INFO] Attempting to connect with the MKS Integrity Server
[INFO] Creating session for myUser/***********
[INFO] Attempting to establish connection using myUser@myServer:7001
com.mks.connect.BlimpException: Attempt to launch MKS Integrity Client Timed out. To solve this please try the following:
- Verify that the user you are logged in as has read and write permissions to the Integrity Client install directory.
- Make sure the Integrity Client install directory is the very first entry in the path.
    at com.mks.connect.ClientCmdRunnerImpl.icInitialize(Native Method)
    at com.mks.connect.ClientCmdRunnerImpl.checkIntegrityClientForLaunch(ClientCmdRunnerImpl.java:71)
    at com.mks.connect.ClientCmdRunnerImpl.executePreCondition(ClientCmdRunnerImpl.java:95)
    at com.mks.connect.AbstractCmdRunner.executeCommand(AbstractCmdRunner.java:235)
    at com.mks.connect.AbstractCmdRunner.execute(AbstractCmdRunner.java:394)
    at org.apache.maven.scm.provider.integrity.APISession.connect(APISession.java:134)
    at org.apache.maven.scm.provider.integrity.command.login.IntegrityLoginCommand.executeLoginCommand(IntegrityLoginCommand.java:66)
    at org.apache.maven.scm.command.login.AbstractLoginCommand.executeCommand(AbstractLoginCommand.java:45)
    at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
    at org.apache.maven.scm.provider.integrity.IntegrityScmProvider.login(IntegrityScmProvider.java:182)
    at org.apache.maven.scm.provider.AbstractScmProvider.login(AbstractScmProvider.java:742)
    at org.apache.maven.scm.provider.AbstractScmProvider.status(AbstractScmProvider.java:784)
    at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:126)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:277)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:232)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
[ERROR] MKS API Exception: Attempt to launch MKS Integrity Client Timed out. To solve this please try the following:
- Verify that the user you are logged in as has read and write permissions to the Integrity Client install directory.
- Make sure the Integrity Client install directory is the very first entry in the path.
[INFO]  exited with return code -1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.694s
[INFO] Finished at: Mon Feb 17 16:49:07 CET 2014
[INFO] Final Memory: 17M/310M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project javatests-test04: An error occurred during the status check process: Can't login.
[ERROR] Exit Code: -1
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project javatests-test04: An error occurred during the status check process: Can't login.
Exit Code: -1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error occurred during the status check process: Can't login.
Exit Code: -1
    at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:281)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:232)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 30 more
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: An error occurred during the status check process: Can't login.
Exit Code: -1
    at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:131)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:277)
    ... 33 more
Caused by: org.apache.maven.scm.ScmException: Can't login.
Exit Code: -1
    at org.apache.maven.scm.provider.AbstractScmProvider.login(AbstractScmProvider.java:746)
    at org.apache.maven.scm.provider.AbstractScmProvider.status(AbstractScmProvider.java:784)
    at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:126)
    ... 38 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[JENKINS] Archiving pathToWorkspace\workspace\pom.xml to pathToRepository/javatests-test04/0.0.4-SNAPSHOT/javatests-test04-0.0.4-SNAPSHOT.pom
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
Finished: FAILURE

Thanks for your Help! :)

Krummy
  • 658
  • 15
  • 24
0

I found a workaround that worked for me: The plugin genreates some environment variables. Most of them are given and created automatic and one (IS_M2RELEASEBUILD) is editable in in the advanced settings of the option point "maven release build"

My solution:

1.) Check the "Maven release build" in the build environment to gain access to some values later.

2.) Create a "Conditional Step (Single)" as a Pre Step AND as a Post Step

2.1) Both should have a Boolean condition with a token: ${ENV,var="IS_M2RELEASEBUILD"}

2.2) Both should have "call Maven goal" as build step.

Goal for the pre step: *versions:set -DnewVersion=${MVN_RELEASE_VERSION}*

Goal for the post step: *versions:set -DnewVersion=${MVN_DEV_VERSION}*

The value of this variables are the same you enter when a release build is started.

3.) As "normal" build step i simple call a maven goal with "compile"

4.) Add Post-Build-Action: Integrity - CM Checkin with path to your MKS project and other options that are maybe needed here.

5.) Finished! (Dont forget to set your Distribution options in your pom.xml to tell Jenkins and Maven where the release results should be saved)

Krummy
  • 658
  • 15
  • 24