1

我正在试验 Ivy 2.3.0、Artifactory 3.0.3 和 Ant。问题是,如果我使用的文件的扩展名不是 .jar,我无法设置 ivy:buildnumber 以针对 Artifactory 存储库工作。它适用于我的本地产品。当我尝试对 Artifactory 进行尝试时,如果无法设置内部版本号。使用 -debug 运行 Ant 我得到以下输出:

Setting project property: ivy.version -> 2.3.0
[ivy:buildnumber]       using oe to list all in ${http://localhost:8081/artifactory/repo/com/testorg/testmod
[ivy:buildnumber]       using oe to list all in http://localhost:8081/artifactory/repo/com/testorg/testmod/
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841/].
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml].
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml.md5].
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml.sha1].
[ivy:buildnumber]               found 4 resources
[ivy:buildnumber]       using oe to list all in http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841/testmod-20130814190841.pl].
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841/testmod-20130814190841.pl.md5].
[ivy:buildnumber] ApacheURLLister found URL=[http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841/testmod-20130814190841.pl.sha1].
[ivy:buildnumber]               found 3 urls
[ivy:buildnumber]               0 matched http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841/[artifact]-20130814190841.jar
[ivy:buildnumber]       using oe to list all in http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml
[ivy:buildnumber] HTTP response status: 404 url=http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml/
[ivy:buildnumber] CLIENT ERROR: Not Found url=http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml/
[ivy:buildnumber] problem while listing resources in http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml with oe:
[ivy:buildnumber]   java.io.IOException The HTTP response code for http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml/ did not indicate a success. See log for more detail.
[ivy:buildnumber]       using oe to list all in http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml.md5
[ivy:buildnumber]               found 0 urls
[ivy:buildnumber]               0 matched http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml.md5/[artifact]-ivy-20130814190841.xml.md5.jar
[ivy:buildnumber]       using oe to list all in http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml.sha1
[ivy:buildnumber]               found 0 urls
[ivy:buildnumber]               0 matched http://localhost:8081/artifactory/repo/com/testorg/testmod/ivy-20130814190841.xml.sha1/[artifact]-ivy-20130814190841.xml.sha1.jar
Setting project property: ivy.new.revision -> 0
Setting project property: ivy.new.build.number -> 0
Property "ivy.build.number" has not been set
  [echo] new.rev: working@Win7Dev 0 ${ivy.build.number} 0

关键线似乎是:

[ivy:buildnumber]               0 matched http://localhost:8081/artifactory/repo/com/testorg/testmod/20130814190841/[artifact]-20130814190841.jar

如果文件是 .jar 文件,则显示“1 匹配...”并设置了内部版本号。另一方面,如果它是其他文件,例如 .zip,则会失败,如上所示。

ivy.xml文件中item的定义是:

<publications>
  <artifact name="testmod" ext="zip" type="zip"/>
</publications> 

在 Artifactory 中,我创建了一个带有 maven-2-default 布局并包含 testmod 的仓库。

我的 Ant 目标包含:

<ivy:info/>

<ivy:buildnumber resolver="oe" organisation="${ivy.organisation}" module="${ivy.module}"/>

<echo>new.rev: ${ivy.revision} ${ivy.new.revision} ${ivy.build.number} ${ivy.new.build.number}</echo>

oe解析器定义如下:

<url name="oe" m2compatible="true" >
  <ivy pattern="${http://localhost:8081/artifactory/repo/[organisation]/[module]/ivy-[revision].xml"/>
  <artifact pattern="http://localhost:8081/artifactory/repo/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>      
</url> 

如果我使用定义如下的 ibiblio 解析器,调试输出和结果是相同的:

<ibiblio name="oe1" m2compatible="true" root="http://localhost:8081/artifactory/repo" useMavenMetadata="false"/> 

Artifactory repo 中的模块使用 Jenkins Artifactory 插件到达那里。这使用:

Ivy pattern: [organisation]/[module]/ivy-[revision].xml 
Artifact pattern: [organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]
4

1 回答 1

0

似乎工件没有选择带有 2 个字符的扩展,它必须至少有 3 个字符....我也不明白为什么。

于 2014-06-16T11:05:35.023 回答