【问题标题】:Ivy Resolve of "latest.integration" fails when run from Jenkins从 Jenkins 运行时,“latest.integration”的 Ivy Resolve 失败
【发布时间】:2014-04-01 11:03:44
【问题描述】:

所以我有一个现有的 ant 构建,我想使用 Ivy 解决它的依赖关系。我有一个 ivy.xml 和 ivysettings.xml 文件,它们都可以在 Eclipse 中与 IvyDE 一起使用,并且在从命令行针对 ivy-2.3.0.jar 运行时也可以使用。 (它们的工作方式与 Ivy 报告中下载了依赖项一样)。

我遇到的问题是,当“rev”属性列为“latest.integration”时,从任何构建脚本运行时它们都不起作用。如果我指定一个版本,那么依赖关系就解决了。需要明确的是,此特定依赖项是由 Artifactory 托管的内部库。

对于我可以改变什么或尝试找出问题,我感到很困惑。运行 ivy findrevision 时,我遇到了同样的失败。

要注意 Jenkins 在 Mac 上运行,但我可以直接使用 Ivy jar 来解决依赖关系,使用该机器上的相同 ivy 文件,该问题仅与通过 Jenkins 解决时有关。

我意识到这不太可能是某人可以看到并直接指出问题的地方,特别是考虑到在看似所有其他情况下,即使通过 eclipse 从 ant 构建运行 sn-p,解析也可以正常工作.但如果有人有任何建议,他们会非常欢迎!

无论如何我的 ivy.xml

<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info
        organisation="MyOrg"
        module="MyModule"
        status="integration">
    </info>

    <dependencies>
        <dependency org="MyOrg" name="DEP" rev="latest.integration">
            <artifact name="DEP" type="jar" ext="jar" />
        </dependency>
        <dependency org="junit" name="junit" rev="4.8.1" />
    </dependencies>
</ivy-module>

还有我的 ivysettings.xml(依赖项被命名为例如 DEP-0.1-SNAPSHOT.jar)

<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
  <settings defaultResolver="snapshot" />
  <!--Authentication required for publishing (deployment). 'Artifactory Realm' is the realm used by Artifactory so don't change it.-->
  <credentials host="HOST" realm="Artifactory Realm" username="USR" passwd="PASS" />
  <resolvers>
    <chain name="main">
      <!-- <ibiblio name="release" m2compatible="true" root="http://HOST/artifactory/libs-release" /> -->
      <chain name="snapshot" changingPattern="0.*" checkmodified="true">
        <ibiblio name="public" m2compatible="true" root="http://HOST/artifactory/libs-snapshot" />
      </chain>
    </chain>
  </resolvers>
</ivy-settings>

最后我的构建脚本看起来像

<project name="MyModule Continuous Integration" xmlns:ivy="antlib:org.apache.ivy.ant">
....
<target name = "resolveDependencies" >
    <ivy:configure file="/MyModule/ivysettings.xml" />
    <ivy:findrevision organisation="MyOrg" module="DEP" revision="latest.integration" property="found.revision" />
    <echo message="Found revision: ${found.revision}" />
    <ivy:resolve file="/MyModule/ivy.xml" refresh="true" type="jar" />
    <ivy:cachepath pathid="ivy.dependencies" />
</target>
....
</project>

为了完成,我从 Jenkins 构建中获得的输出是:

[ivy:findrevision] snapshot: Checking cache for: dependency: MyOrg#DEP;latest.integration {}
[ivy:findrevision] don't use cache for MyOrg#DEP;latest.integration: checkModified=true
[ivy:findrevision] default-cache: no cached resolved revision for MyOrg#DEP;latest.integration
[ivy:findrevision]      tried http://HOST/artifactory/libs-snapshot/MyOrg/DEP/[revision]/DEP-[revision].pom
[ivy:findrevision] CLIENT ERROR: Not Found url=http://HOST/artifactory/libs-snapshot/MyOrg/DEP/maven-metadata.xml
[ivy:findrevision]  maven-metadata not available: http://HOST/artifactory/libs-snapshot/MyOrg/DEP/maven-metadata.xml
[ivy:findrevision] WARN: problem while listing resources in http://HOST/artifactory/libs-snapshot/MyOrg/DEP/ with public:
[ivy:findrevision] WARN:   java.lang.NullPointerException null
[ivy:findrevision]      tried http://HOST/artifactory/libs-snapshot/MyOrg/DEP/[revision]/DEP-[revision].jar
[ivy:findrevision]  maven-metadata not available: http://HOST/artifactory/libs-snapshot/MyOrg/DEP/maven-metadata.xml
[ivy:findrevision] WARN: problem while listing resources in http://HOST/artifactory/libs-snapshot/MyOrg/DEP/ with public:
[ivy:findrevision] WARN:   java.lang.NullPointerException null
[ivy:findrevision]  public: no ivy file nor artifact found for MyOrg#DEP;latest.integration
Property "found.revision" has not been set
     [echo] Found revision: ${found.revision}

再次感谢您的任何想法,

丹。

【问题讨论】:

    标签: jenkins ivy resolve


    【解决方案1】:

    为了将来参考,我已经设法通过切换到最新的 Ivy 2.4 alpha 版本来解决这个问题。看来一定是2.3.0的问题。

    【讨论】:

      猜你喜欢
      • 2012-06-18
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多