梅文 + Mercurial:执行命令标签时出错

发布于 2024-10-18 10:12:46 字数 9008 浏览 6 评论 0原文

我想使用 Maven-Release-Plugin 发布项目的新版本。

但是,我收到以下错误:

[INFO] Tagging release with the label softsmithy-lib-v0.1...                                                                                     
[INFO] EXECUTING: /bin/sh -c cd /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release && hg tag --message '[maven-release-plugin]  copy for tag softsmithy-lib-v0.1' softsmithy-lib-v0.1                                                                                                        
[ERROR]                                                                                                                                          
EXECUTION FAILED                                                                                                                                 
  Execution of cmd : tag failed with exit code: 255.                                                                                             
  Working directory was:                                                                                                                         
    /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release                                                                                      
  Your Hg installation seems to be valid and complete.                                                                                           
    Hg version: 1.7.5 (OK)                                                                                                                       


[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR                                                            
[INFO] ------------------------------------------------------------------------
[INFO] An error is occurred in the tag process: Exception while executing SCM command.

Error while executing command tag --message [maven-release-plugin]  copy for tag softsmithy-lib-v0.1 softsmithy-lib-v0.1
[INFO] ------------------------------------------------------------------------                                         
[INFO] Trace                                                                                                            
org.apache.maven.lifecycle.LifecycleExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)                         
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)                
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)                          
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)         
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)                  
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)                              
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)                                                              
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)                                                                
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)                                                                       
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)                                                     
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)                                               
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)                                       
        at java.lang.reflect.Method.invoke(Method.java:597)                                                                            
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)                                                         
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)                                                                 
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)                                                       
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)                                                                   
Caused by: org.apache.maven.plugin.MojoExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:215)                                
        at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:181)                                       
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)                                        
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)                            
        ... 17 more                                                                                                                       
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: An error is occurred in the tag process: Exception while executing SCM command.                                                                                                                                             
        at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:113)                                                       
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:203)                                         
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:140)                                         
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:103)                                         
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:211)                                       
        ... 20 more                                                                                                                              
Caused by: org.apache.maven.scm.ScmException: Exception while executing SCM command.                                                             
        at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)                                                         
        at org.apache.maven.scm.provider.hg.HgScmProvider.tag(HgScmProvider.java:239)                                                            
        at org.apache.maven.scm.provider.AbstractScmProvider.tag(AbstractScmProvider.java:706)                                                   
        at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:109)                                                       
        ... 24 more                                                                                                                              
Caused by: org.apache.maven.scm.ScmException: Error while executing command tag --message [maven-release-plugin]  copy for tag softsmithy-lib-v0.1 softsmithy-lib-v0.1                                                                                                                            
        at org.apache.maven.scm.provider.hg.command.tag.HgTagCommand.executeTagCommand(HgTagCommand.java:105)                                    
        at org.apache.maven.scm.command.tag.AbstractTagCommand.executeCommand(AbstractTagCommand.java:81)                                        
        at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)                                                         
        ... 27 more         

我尝试运行

/bin/sh -c cd /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release && hg tag --message '[maven-release-plugin]  copy for tag softsmithy-lib-v0.1' softsmithy-lib-v0.1

并且运行良好!

有什么想法出了什么问题吗?

PS:我在以下网站上注意到: http://maven.apache.org/scm/matrix.html

提到Mercurial标签命令是不支持,但它似乎执行命令(然后以某种方式失败)。如何将 Maven 发布插件与 Mercurial 一起使用?

PPS:这似乎只发生在多模块项目中。单个 POM 项目运行良好。我尝试了 -DpreparationGoals="clean install" 但没有帮助。

I want to release a new version of my project using the Maven-Release-Plugin.

I get the following error, though:

[INFO] Tagging release with the label softsmithy-lib-v0.1...                                                                                     
[INFO] EXECUTING: /bin/sh -c cd /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release && hg tag --message '[maven-release-plugin]  copy for tag softsmithy-lib-v0.1' softsmithy-lib-v0.1                                                                                                        
[ERROR]                                                                                                                                          
EXECUTION FAILED                                                                                                                                 
  Execution of cmd : tag failed with exit code: 255.                                                                                             
  Working directory was:                                                                                                                         
    /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release                                                                                      
  Your Hg installation seems to be valid and complete.                                                                                           
    Hg version: 1.7.5 (OK)                                                                                                                       


[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR                                                            
[INFO] ------------------------------------------------------------------------
[INFO] An error is occurred in the tag process: Exception while executing SCM command.

Error while executing command tag --message [maven-release-plugin]  copy for tag softsmithy-lib-v0.1 softsmithy-lib-v0.1
[INFO] ------------------------------------------------------------------------                                         
[INFO] Trace                                                                                                            
org.apache.maven.lifecycle.LifecycleExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)                         
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)                
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)                          
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)         
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)                  
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)                              
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)                                                              
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)                                                                
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)                                                                       
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)                                                     
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                 
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)                                               
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)                                       
        at java.lang.reflect.Method.invoke(Method.java:597)                                                                            
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)                                                         
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)                                                                 
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)                                                       
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)                                                                   
Caused by: org.apache.maven.plugin.MojoExecutionException: An error is occurred in the tag process: Exception while executing SCM command.
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:215)                                
        at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:181)                                       
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)                                        
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)                            
        ... 17 more                                                                                                                       
Caused by: org.apache.maven.shared.release.ReleaseExecutionException: An error is occurred in the tag process: Exception while executing SCM command.                                                                                                                                             
        at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:113)                                                       
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:203)                                         
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:140)                                         
        at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:103)                                         
        at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:211)                                       
        ... 20 more                                                                                                                              
Caused by: org.apache.maven.scm.ScmException: Exception while executing SCM command.                                                             
        at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)                                                         
        at org.apache.maven.scm.provider.hg.HgScmProvider.tag(HgScmProvider.java:239)                                                            
        at org.apache.maven.scm.provider.AbstractScmProvider.tag(AbstractScmProvider.java:706)                                                   
        at org.apache.maven.shared.release.phase.ScmTagPhase.execute(ScmTagPhase.java:109)                                                       
        ... 24 more                                                                                                                              
Caused by: org.apache.maven.scm.ScmException: Error while executing command tag --message [maven-release-plugin]  copy for tag softsmithy-lib-v0.1 softsmithy-lib-v0.1                                                                                                                            
        at org.apache.maven.scm.provider.hg.command.tag.HgTagCommand.executeTagCommand(HgTagCommand.java:105)                                    
        at org.apache.maven.scm.command.tag.AbstractTagCommand.executeCommand(AbstractTagCommand.java:81)                                        
        at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)                                                         
        ... 27 more         

I tried to run

/bin/sh -c cd /var/lib/hudson/jobs/SoftSmithy-Utility-Library-Release && hg tag --message '[maven-release-plugin]  copy for tag softsmithy-lib-v0.1' softsmithy-lib-v0.1

and it worked fine!

Any ideas what is going wrong?

PS: I noted that on the following site:
http://maven.apache.org/scm/matrix.html

it is mentioned that the Mercurial tag command is not supported, but it seems to execute the command (and then fails somehow). How can I use the Maven Release Plugin with Mercurial?

PPS: This only seems to happen for multi-module projects. Single POM project runs fine. I tried -DpreparationGoals="clean install" but it didn't help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝咒 2024-10-25 10:12:46

我终于找到了解决方案:

所需的父 POM

<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>6</version>

使用 Maven Release Plugin 版本 2.0

不幸的是,使用 Mercurial 的多模块项目存在问题。
使用版本 2.1 时,该问题消失了。

解决方法:覆盖项目 POM/项目父 POM 中的版本。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.1</version>
  <configuration>
    <mavenExecutorId>forked-path</mavenExecutorId>
    <useReleaseProfile>false</useReleaseProfile>
    <arguments>-Psonatype-oss-release</arguments>
  </configuration>
</plugin>

我在这里提出了一个问题:
https://issues.sonatype.org/browse/OSSRH-1388

I finally found the solution:

The required parent POM

<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>6</version>

uses Maven Release Plugin version 2.0

Unfortunatly, there is an issue with multi-module projects using Mercurial.
The issue goes away, when using version 2.1

Work-around: override the version in the project POM/ project parent POM.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.1</version>
  <configuration>
    <mavenExecutorId>forked-path</mavenExecutorId>
    <useReleaseProfile>false</useReleaseProfile>
    <arguments>-Psonatype-oss-release</arguments>
  </configuration>
</plugin>

I filed an issue here:
https://issues.sonatype.org/browse/OSSRH-1388

和影子一齐双人舞 2024-10-25 10:12:46

如果您查看 HgTagCommand.java,它包括一些启动此类异常的地方(即“执行命令时出错”):

标签[消息]的是:

ScmResult result = HgUtils.execute( branchConsumer, getLogger(), workingDir, branchCmd );
HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;

if ( !result.isSuccess() )
{
  throw new ScmException( "Error while executing command " + joinCmd( branchCmd ) );
}

关于 看起来与多模块项目兼容,您可以在其中拥有多个 Mercurial 存储库。

If you look at the source file for HgTagCommand.java, it includes a few places where this kind of exception is launched (i.e. "Error while executing command"):

The one regarding tag [message] is:

ScmResult result = HgUtils.execute( branchConsumer, getLogger(), workingDir, branchCmd );
HgScmProviderRepository repository = (HgScmProviderRepository) scmProviderRepository;

if ( !result.isSuccess() )
{
  throw new ScmException( "Error while executing command " + joinCmd( branchCmd ) );
}

And that don't look compatible with a multi-modules project, where you can have multiple Mercurial repositories.

手心的温暖 2024-10-25 10:12:46

我遇到了同样的问题,这是因为 maven release 进行了 3 次提交(至少在 Mercurial 中):

  • 准备发布 制作
  • 发布的标签
  • 准备下一次开发迭代

有时如果您的项目或发布插件的配置配置不正确,release 卡在第一次提交中。问题是,有时它已经将版本更新到您的 sonatype 服务器中,因此您必须从 sonatype 服务器中删除这个假版本,配置好您的父项目的 pom.xml,编译项目,并再次释放。
这就是我删除项目 bridje-parent 中的错误版本 1.0.0-alpha5 时的样子:

在此处输入图像描述

同时删除位于其子模块中的假 release。请记住在发布发布之前在您的scm服务器中提交更改。
如果它对你有用,请投票,这种情况很少发生在我身上。

I had the same problem, it was because of maven release makes 3 commits (at least in mercurial):

  • Prepare the release
  • Make the tag of the release
  • Prepare for next development iteration

And sometimes if your project or release plugin´s configuration is not right configured, the release get stuck in the first commit. The problem is that sometimes it already updated the release into your sonatype server, so you have to delete this fake release from the sonatype server, configurate well your parent project´s pom.xml, compile the project, and release again.
This is how i looked while i delete my false release 1.0.0-alpha5 in the project bridje-parent:

enter image description here

Also delete the fake release located in its submodules. Remember to commit changes in your scm server before making a release.
Vote if it worked for you, it happened to me very seldom.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文