I am using the following plugin in my code:
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<username>${bbuser}</username>
<password>${bbpw}</password>
<flowInitContext>
<masterBranchName>master</masterBranchName>
<developBranchName>develop</developBranchName>
<featureBranchPrefix>SPRINT-</featureBranchPrefix>
<releaseBranchPrefix>release-</releaseBranchPrefix>
<hotfixBranchPrefix>hotfix-</hotfixBranchPrefix>
</flowInitContext>
</configuration>
</plugin>
To execute it I do the following:
mvn -e -X -B -Dbbuser=$env.GIT_USERNAME -Dbbpw=$env.GIT_PASSWORD -DnoDeploy=true -DnoReleaseBuild=true -DpushReleases=true jgitflow:release-start
This works locally but in Jenkins I get the following exception:
[ERROR] Failed to execute goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-start (default-cli) on project steeringcockpit: Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-start failed: String index out of range: -6 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-start (default-cli) on project steeringcockpit: Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-start failed: String index out of range: -6
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal external.atlassian.jgitflow:jgitflow-maven-plugin:1.0-m5.1:release-start failed: String index out of range: -6
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -6
at java.lang.String.substring(String.java:1931)
at com.atlassian.jgitflow.core.util.GitHelper.localBranchExists(GitHelper.java:193)
at com.atlassian.jgitflow.core.GitFlowConfiguration.hasMasterConfigured(GitFlowConfiguration.java:128)
at com.atlassian.jgitflow.core.JGitFlowInitCommand.call(JGitFlowInitCommand.java:152)
at com.atlassian.maven.plugins.jgitflow.provider.DefaultJGitFlowProvider.gitFlow(DefaultJGitFlowProvider.java:32)
at com.atlassian.maven.plugins.jgitflow.manager.AbstractFlowReleaseManager.runPreflight(AbstractFlowReleaseManager.java:67)
at com.atlassian.maven.plugins.jgitflow.manager.AbstractProductionBranchManager.getStartLabelAndRunPreflight(AbstractProductionBranchManager.java:50)
at com.atlassian.maven.plugins.jgitflow.manager.DefaultFlowReleaseManager.start(DefaultFlowReleaseManager.java:45)
at com.atlassian.maven.plugins.jgitflow.mojo.ReleaseStartMojo.execute(ReleaseStartMojo.java:113)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
I would like to debug the execution of the plugin somehow using mvnDebug and the Eclipse debugger to set a breakpoint at this line to check what is happening locally. The problem is I don't know how to attach the source of the plugin to my eclipse environment and I cannot even find the plugins source in my local repository.
It would be extra cool if I could debug it within jenkins. Is this possible?
Source code are there: https://bitbucket.org/atlassian/jgit-flow/src/1.0-m5.1/ (for your plugin version)
Please clone/download
jgit-flow
to local machine, open project in your Eclipse as new one. Now you can set breakpoint for plugin code.Prepare configuration for remote debugging in Eclipse for localhost at 8000 port.
In separate ide / console run
mvnDebug
on your project and when you see something like:Start debug session in Eclipse with opened plugin code