Jenkins 和 maven-buildnumber-plugin

发布于 2024-10-26 03:01:15 字数 3742 浏览 5 评论 0原文

我正在使用 maven-buildnumber-plugin 版本 1.0-beta-4。这在从 Subversion 签出的项目上运行良好,但在 Jenkins 中失败。

我认为这个问题是由于 Jenkins 以某种方式删除了 .svn 文件夹。

我以为错了。这是我得到的错误:

maven builder waiting
mavenExecutionResult exceptions not empty
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.0-beta-4:create (default) on project swift-core: Cannot get the revision information from the scm repository : 
Error!
    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:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
    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.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:146)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:124)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:270)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot get the revision information from the scm repository : 
Error!
    at org.codehaus.mojo.build.CreateMojo.getRevision(CreateMojo.java:673)
    at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:431)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 27 more
Caused by: org.apache.maven.scm.ScmException: Error!
    at org.codehaus.mojo.build.CreateMojo.checkResult(CreateMojo.java:753)
    at org.codehaus.mojo.build.CreateMojo.getRevision(CreateMojo.java:648)
    ... 30 more

我忽略了这一点:

Provider message:
The svn command failed.
Command output:
/bin/sh: svn: command not found

mojoFailed org.codehaus.mojo:buildnumber-maven-plugin:1.0-beta-4(default)

机器上没有安装 svn 客户端,这才是麻烦的真正根源。

I am using maven-buildnumber-plugin version 1.0-beta-4. This works fine on a project checked out of Subversion, but fails in Jenkins.

I assume this problem is due to Jenkins somehow removing the .svn folders.

I assumed wrong. Here is the error I got:

maven builder waiting
mavenExecutionResult exceptions not empty
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.0-beta-4:create (default) on project swift-core: Cannot get the revision information from the scm repository : 
Error!
    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:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
    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.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:146)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:124)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
    at hudson.remoting.UserRequest.perform(UserRequest.java:114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:270)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot get the revision information from the scm repository : 
Error!
    at org.codehaus.mojo.build.CreateMojo.getRevision(CreateMojo.java:673)
    at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:431)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 27 more
Caused by: org.apache.maven.scm.ScmException: Error!
    at org.codehaus.mojo.build.CreateMojo.checkResult(CreateMojo.java:753)
    at org.codehaus.mojo.build.CreateMojo.getRevision(CreateMojo.java:648)
    ... 30 more

I overlooked this:

Provider message:
The svn command failed.
Command output:
/bin/sh: svn: command not found

mojoFailed org.codehaus.mojo:buildnumber-maven-plugin:1.0-beta-4(default)

There is no svn client installed on the machine, that is the true source of trouble.

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

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

发布评论

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

评论(1

睫毛上残留的泪 2024-11-02 03:01:15

错误消息显示命令 svn 未安装在构建计算机上。您可以使用 javasvn 作为您的提供程序实现,并进行以下配置:

   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>create</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <doCheck>true</doCheck>
      <doUpdate>true</doUpdate>
      <providerImplementations>
        <svn>javasvn</svn>
      </providerImplementations>          
    </configuration>
  </plugin>

请参阅 http://mojo.codehaus.org/buildnumber-maven-plugin/using-svnjava.html

如果您需要特定版本的 Subversion(我们仍然使用 1.5) )你也可以固定到 svnkit 的特定版本:

    <dependency>
        <groupId>org.tmatesoft.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.2.3.5521</version>
    </dependency>

The error message shows that the command svn is not installed on the build machine. You can use javasvn as your providerImplementation with this configuration:

   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>create</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <doCheck>true</doCheck>
      <doUpdate>true</doUpdate>
      <providerImplementations>
        <svn>javasvn</svn>
      </providerImplementations>          
    </configuration>
  </plugin>

See http://mojo.codehaus.org/buildnumber-maven-plugin/using-svnjava.html

If you need a specific version of Subversion (we're still using 1.5 here) you can pin to a specific version of svnkit too:

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