mvn release - 标记时出现 svn 错误

mvn release - svn error while tagging

在尝试执行 release:prepare 目标时,出现以下故障:

...
[INFO] Checking in modified POMs...
[INFO] SVN commit directory: C:\dev\eclipse\workspace\xxx-parent
[INFO] Tagging release with the label xxx-parent-0.0.1...
[INFO] SVN checkout directory: C:\dev\eclipse\workspace\xxx-parent
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.603s
[INFO] Finished at: Thu Oct 22 14:43:44 CEST 2015
[INFO] Final Memory: 10M/244M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project xxx-parent: Unable to tag SCM
[ERROR] Provider message:
[ERROR] SVN tag failed.
[ERROR] Command output:
[ERROR] svn: Commit failed (details follow):
[ERROR] svn: Commit blocked by pre-commit hook (exit code 1) with output:
[ERROR] A message is mandatory!
[ERROR] The message must comply to the following structure 'TT 12345: Some explanation'.
[ERROR] Pay attention to the white space between TT and the TT number and between the colon and the explanation.
[ERROR] The explanation after the colon should at least be 10 characters long.
[ERROR] svn: MERGE of '/svn/xxxxx/xxx-parent': 409 Conflict (https://192.19.20.56)
[ERROR] -> [Help 1]
...

该项目在发布版本的主干中得到了很好的更新,但不在TAGS中,看起来它正在尝试做svn合并?!是吗?如果是,为什么?

这是 maven-release-plugin 配置:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <dependencies>
                <dependency>
                    <groupId>com.google.code.maven-scm-provider-svnjava</groupId>
                    <artifactId>maven-scm-provider-svnjava</artifactId>
                    <version>1.6</version>
                </dependency>
            </dependencies>
            <configuration>
                <providerImplementations>
                    <svn>javasvn</svn>
                </providerImplementations>
                <branchBase>https://192.19.20.56/svn/xxxxx/xxx-parent/BRANCHES</branchBase>
                <tagBase>https://192.19.20.56/svn/xxxxx/xxx-parent/TAGS</tagBase>
                <scmCommentPrefix>TT 00000: Tagging release of project ${project.name} ${project.version}, </scmCommentPrefix>
            </configuration>
        </plugin>

Maven 的输出包含指针:

[ERROR] svn: Commit failed (details follow):
[ERROR] svn: Commit blocked by pre-commit hook (exit code 1) with output:
[ERROR] A message is mandatory!
[ERROR] The message must comply to the following structure 'TT 12345: Some explanation'.
[ERROR] Pay attention to the white space between TT and the TT number and between the colon and the explanation.
[ERROR] The explanation after the colon should at least be 10 characters long.

您的团队安装了不允许此提交的预提交挂钩,因为缺少提交消息。我只能假设您包含的 maven-release-plugin 配置不是实际激活的配置,因为它不仅包含提交消息,还包含所需格式的配置:

<scmCommentPrefix>TT 00000: Tagging release of project ${project.name} ${project.version}, </scmCommentPrefix>

您可以像这样尝试 adding a commit message manually by using a command-line parameter

mvn release:prepare -DscmCommentPrefix="TT 00000: Tagging release of project..."

我找到的解决方案是更改发布插件使用的maven-scm-provider-svnjava 的版本。 原来用的是1.6版本,我改成1.15了,有了这个配置,我就可以准备发布了。

Subversion 存储库是 1.6 版,不确定我可以使用的最新版本的 maven-scm-provider-svnjava 是什么。