【问题标题】:How to specify an internal company Maven repo for a Jenkins job to use?如何为要使用的 Jenkins 作业指定内部公司 Maven 存储库?
【发布时间】:2012-01-12 13:14:32
【问题描述】:

我正在尝试在 Jenkins 中设置 Maven2 作业。我的 pom.xml 中有这样的行:

<distributionManagement>
  <repository>
    <id>releases</id>
    <name>Releases</name>
    <url>http://nexus.example.com:8081/nexus/content/repositories/releases</url>
  </repository>
  ...
</distributionManagement>

我在尝试构建作业时收到此错误:

...
Downloading: http://repo1.maven.org/maven2/.../.../.../....jar
[INFO] Unable to find resource 'resource id goes here' in repository central (http://repo1.maven.org/maven2)
...
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
...Here goes the list of missing dependencies.

我确定所需的工件确实存在于 nexus.example.com 存储库中,因为我可以在我的工作站上执行 mvn compile 并且它们会被下载。

但出于某种原因,Jenkins 甚至没有尝试从本地 repo 下载工件,忽略了 pom.xml 中的规范。

任何想法我可以尝试什么?

【问题讨论】:

    标签: maven-2 jenkins


    【解决方案1】:

    您可以通过两种方式解决此错误。

    第一,将&lt;repositories&gt; 部分移出&lt;distributionManagement&gt;&lt;distributionManagement&gt; 部分用于指明您想要在哪里部署工件。

    在 jenkins 正在运行的用户名的 settings.xml 中指定 &lt;repositories&gt; 部分。建议这样做,因为这将适用于您将要构建的所有项目。

    【讨论】:

    • 我已经发现我可以在 jenkins 的 settings.xml 中指定 的东西。那成功了。但我认为你的想法也会有所帮助。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2014-11-13
    • 2011-03-07
    • 2023-03-04
    • 2014-06-26
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 2014-12-28
    相关资源
    最近更新 更多