【问题标题】:"Cannot get the revision information from the scm repository"“无法从 scm 存储库获取修订信息”
【发布时间】:2010-12-09 19:29:51
【问题描述】:

我得到 Maven 错误:

Cannot get the revision information from the scm repository

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

【问题讨论】:

标签: java maven-2 pom.xml


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    确保 Jenkins 和操作系统指向相同的 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 --non-interactive info

    也就是说,我会得到预期的 scm 信息。所以 svn 在路径中,没有问题。

    原来我的 Java 版本的路径是交叉的。

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

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

    但 Jenkins 被配置为使用:

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

    在 PATH 环境变量中,我将 x86 Java 路径替换为 Jenkins 所指向的路径,并且成功了。

    我没有根除路径的方式或原因。从每个路径解析的两个 java.exe 文件似乎是相同的版本。 x86 版本可以运行 svn。根本原因在我的工资等级之上。

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        【解决方案4】:

        嗯...正在将 svn 迁移到 git...并且 pom xml 有 svn repo 链接,因此将其更新为 git,并且可以更新 pom xml scm

        【讨论】:

          【解决方案5】:

          我们可以使用 Netbeans8 解决的一个案例:

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

          我也将正确的 apache SVN 与给定的 maven 属性相匹配

          【讨论】:

            【解决方案6】:

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

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

            【讨论】:

              【解决方案7】:

              我在帮助同事将项目迁移到 Maven 时遇到了 buildnumber-maven-plugin 的错误。

              我们还没有将代码签入迁移项目中的 svn,因此 .svn 文件夹不存在。由于数据不存在,显然它无法获得svn修订版。

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

              【讨论】:

                【解决方案8】:

                快速的search on Google 似乎表明此错误与 buildnumber-maven-plugin 有关。但是,我无法在我的机器(GNU/Linux 上的 Maven 2.2.1、Java 1.6.0_16、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
                • 等等等等

                但是如果没有关于你的上下文、你的环境、你在做什么、什么时候发生这个错误等等的更多信息,似乎很难在诊断中走得更远。

                【讨论】:

                • 我安装了svn客户端,问题就解决了。谢谢。
                • 我也看到了错误版本的 .svn 客户端。 SVN 1.7+ 使用单个目录来存储所有 .svn 文件,而 1.6- 在每个目录中都有一个 .svn 文件夹。这可能会导致在每个文件夹中都有一个 .svn 目录的插件出现问题。
                猜你喜欢
                • 2016-06-04
                • 1970-01-01
                • 1970-01-01
                • 2010-10-12
                • 1970-01-01
                • 1970-01-01
                • 2014-09-29
                • 2012-06-22
                • 1970-01-01
                相关资源
                最近更新 更多