0

我在我的代码中使用以下插件:

            <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>

要执行它,我执行以下操作:

 mvn -e -X -B -Dbbuser=$env.GIT_USERNAME -Dbbpw=$env.GIT_PASSWORD -DnoDeploy=true -DnoReleaseBuild=true -DpushReleases=true jgitflow:release-start

这在本地有效,但在詹金斯我得到以下异常:

    [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

我想以某种方式使用 mvnDebug 和 Eclipse 调试器来调试插件的执行,以便在该行设置断点以检查本地发生的情况。问题是我不知道如何将插件的源附加到我的 eclipse 环境中,我什至无法在本地存储库中找到插件源。

如果我可以在 jenkins 中调试它会更加酷。这可能吗?

4

1 回答 1

1

源代码在那里: https ://bitbucket.org/atlassian/jgit-flow/src/1.0-m5.1/ (适用于您的插件版本)

请克隆/下载jgit-flow到本地机器,在 Eclipse 中打开项目作为新项目。现在您可以为插件代码设置断点。

在 Eclipse 中为 8000 端口的 localhost 准备远程调试配置。

在您的项目上运行单独的 ide/consolemvnDebug时,当您看到类似以下内容时:

Preparing to execute Maven in debug mode
Listening for transport dt_socket at address: 8000

使用打开的插件代码在 Eclipse 中启动调试会话

于 2020-09-03T16:22:07.367 回答