“无法从scm存储库获取修订信息”

时间:2009-10-24 22:17:43

标签: java maven-2 pom.xml

我得到了maven错误:

“无法从scm存储库获取修订信息”

知道如何解决这个问题吗?

感谢。

8 个答案:

答案 0 :(得分:1)

快速search on Google似乎表明此错误与buildnumber-maven-plugin有关。但是,我无法在我的机器上的命令行上重现错误(Maven 2.2.1,Java 1.6.0_16,GNU / Linux上的svn 1.6.5):

pascal@laptop:~/tmp/$ svn co http://wiquery.googlecode.com/svn/branches/1.0-m2 wiquery
...
pascal@laptop:~/tmp/$ cd wiquery
pascal@laptop:~/tmp/wiquery$ mvn validate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building WiQuery project
[INFO]    task-segment: [validate]
[INFO] ------------------------------------------------------------------------
[INFO] [buildnumber:create {execution: default}]
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /home/pascal/tmp/wiquery && svn --non-interactive info
[INFO] Working directory: /home/pascal/tmp/wiquery
[INFO] Storing buildNumber: 208 at timestamp: 1256499766371
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Sun Oct 25 20:42:46 CET 2009
[INFO] Final Memory: 13M/77M
[INFO] ------------------------------------------------------------------------
pascal@laptop:~/tmp/wiquery$ 

从我在Google上看到的,可能的问题原因包括:

  • svn可执行文件(即Windows上的svn.exe)不在路径上
  • 与您的svn客户端相比,svnkit版本太旧了(请参阅this thread
  • OS X上缺少环境变量(请参阅MOJO-1289
  • 等等

但是如果没有关于您的上下文,您的环境,您正在做的事情,发生此错误等的更多信息,那么在诊断中似乎很难进一步。

答案 1 :(得分:1)

当我帮助同事将他的项目迁移到Maven时,我使用buildnumber-maven-plugin遇到了这个错误。

我们尚未在迁移的项目中将代码检入svn,因此.svn文件夹不存在。显然,由于数据不存在,它无法获得svn版本。

解决方案是注释掉插件,将代码导入svn。使用支持svn的代码执行构建,然后重新插入插件并排除任何其他错误。 (在Hudson上运行时,我们遇到了doUpdate的一些问题,所以我们删除了这些步骤。)

答案 2 :(得分:1)

当.svn不存在时,此错误是由buildnumber-maven-plugin中的javasvn提供程序引起的。从SVN签出您的项目或不使用javasvn。如果没有javasvn,buildnumber-maven-plugin使用命令行svn客户端,那么在这种情况下,即使没有.svn目录,buildnumber-maven-plugin也可以继续(但是内部版本号没有正确设置)。

我认为这是buildnumber-maven-plugin中的一个错误,当.svn目录丢失时,javasvn无法继续。

答案 3 :(得分:0)

我们可以通过 Netbeans8

解决一个问题

enter image description here

请注意,选中了Prefer Old Subversion 1.6格式

并且我还将正确的apache SVN与给定的maven属性匹配

答案 4 :(得分:0)

我遇到了问题,我在Windows上的解决方案是: 将环境变量PATH设置为“... \ git \ bin”。 Java无法找到使用Git的目录。

答案 5 :(得分:0)

确保Jenkins和OS指向相同版本的Java。

我在Windows上运行Jenkins 2.121.2时遇到了类似的问题。

构建将成功,但是我没有任何scm数据。

相关控制台输出:

[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ amis ---
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: D:\Program Files (x86)\Jenkins\workspace\myWebapp
[WARNING] Cannot get the revision information from the scm repository, proceeding with revision of Unavailable : 
Exception while executing SCM command.
[INFO] Storing buildNumber: Unavailable at timestamp: 1534704912706
[INFO] Executing: cmd.exe /X /C "svn --non-interactive info"
[INFO] Working directory: D:\Program Files (x86)\Jenkins\workspace\myWebapp
[WARNING] Cannot get the branch information from the scm repository, proceeding with UNKNOWN_BRANCH : 
Exception while executing SCM command.
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH

但是在DOS中,以下命令将起作用:

D:\ Program Files(x86)\ Jenkins \ workspace \ myWebapp \ svn-非交互式信息

也就是说,我将获得预期的scm信息。因此svn一直在前进,那里没问题。

事实证明,我的Java版本的路径被划破了。

我的PATH环境变量中的第一个与Java相关的路径是:

C:\Program Files (x86)\Common Files\Oracle\Java\javapath

但是Jenkins被配置为使用:

C:\Program Files\Java\jdk1.8.0_181 

在PATH环境变量中,我用Jenkins指向的路径替换了x86 Java路径,并且该路径有效。

我没有消除路径的方式或原因。从每个路径解析的两个java.exe文件似乎是同一版本。 x86版本能够运行svn。根本原因是高于我的薪水等级。

答案 6 :(得分:0)

对于也遇到相同问题的git用户-尝试将git的PATH添加到环境变量中。如果不起作用,请按照此处列出的解决方案-Cannot get the branch information from the scm repository

答案 7 :(得分:-1)

呵呵...正在努力将svn迁移到git ...并且pom xml有svn repo链接因此将其更新为git并且它与更新pom xml scm一起工作