从Jenkins运行时,Ivy Resolve的“latest.integration”失败了

时间:2014-02-28 12:28:33

标签: jenkins ivy resolve

所以我有一个现有的ant构建,我想使用Ivy解决它的依赖关系。我有一个ivy.xml和ivysettings.xml文件,它既可以在Eclipse中使用IvyDE,也可以在从命令行运行ivy-2.3.0.jar时运行。 (它们像常春藤报告一样下载了依赖项)。

我遇到的问题是,当'rev'属性列为'latest.integration'时,从任何构建脚本运行时它们都不起作用。如果我指定版本,则解析依赖项。要明确这个特定的依赖是一个由Artifactory托管的内部库。

我对于我可以改变或试图找出问题感到非常难过。我在运行常春藤findrevision时遇到了同样的失败。

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

我意识到这不太可能是有人可以看到并直接指向问题的东西,特别是考虑到在看似所有其他情况下,甚至通过eclipse从ant构建运行代码段,解析工作正常。但如果有人有任何建议,他们会受到欢迎!

无论如何我的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}

再次感谢任何想法,

1 个答案:

答案 0 :(得分:0)

为了将来参考,我设法通过交换到最新的Ivy 2.4 alpha版本来解决这个问题。似乎它一直是2.3.0的问题。