Jenkins构建失败下载依赖,即使相同的pom在本地工作良好


[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) org.hibernate:hibernate-core:jar:4.0.0.FINAL
...
from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  spring-milestone (http://maven.springframework.org/milestone),
  Hibernate (http://repository.jboss.org/nexus/content/groups/public/)

但是相同的pom和存储库/依赖关系在我的本地开发构建上工作得很好。Jenkins安装在ubuntu的盒子上,所有其他的依赖都工作得很好。我的java home设置为/usr/lib/jvm/java-7-openjdk-i386,我已经更新到最新版本的Jenkins,希望它可以解决问题。

我的resolv.conf看起来像这样(我使用resolvconf包编辑它)

GNU nano 2.2.6            File: /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8

我正在使用jboss存储库下载新的hibernate jar,它在POM中定义如下:

<repository>
  <id>Hibernate</id>
  <name>JBoss Hibernate repository</name>
  <url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>

和我也得到一个警告从maven/jenkins:

[WARNING] 
************ WARNING ************
This Maven runtime contains a LifecycleExecutor component with an incomplete configuration.
LifecycleExecutor class: org.apache.maven.lifecycle.LifecycleExecutorInterceptor
Missing component requirement: org.apache.maven.ConfigurationInterpolator
NOTE: This seems to be a third-party Maven derivative you are using. If so, please
notify the developers for this derivative project of the problem. The Apache Maven team is not
responsible for maintaining the integrity of third-party component overrides.

看起来你在版本编号的'FINAL'部分使用了错误的大小写。试着

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>4.0.0.Final</version>
</dependency>

虽然我真的不知道为什么它已经在本地工作了。也许这是windows不区分大小写的文件系统,并且您已经从其他项目缓存在工件…

在jenkins论坛上报告了一个类似的问题,Peter Liljenberg提供的解决方案是:


你好,我自己没经历过,但我猜你的JAVA_HOME不正确?可能它指向JRE而不是JDK吗?
/彼得

这不是同一个jar丢失了,但可能是相关的。

UPDATE: NimChimpsky更新了问题,结果发现下面的解决方案不适用。我保留它,因为它一个可能的解决方案。

您的Hibernate存储库定义位于哪里?

中有定义吗?
  • 项目的pom文件?在这种情况下,它应该工作良好的詹金斯。
  • %M2_HOME%/settings.xml文件?在这种情况下,您应该在jenkins运行的服务器上定义存储库。

然而,您可以考虑使用二进制存储库管理器解决方案,如Nexus或Artifactory来集中您的存储库管理。

最新更新