常春藤:如果文件扩展名/类型不是.jar,则buildnumber对Artifactory失败

时间:2013-08-16 08:35:41

标签: ant ivy artifactory

我正在尝试使用Ivy 2.3.0,Artifactory 3.0.3和Ant。问题是如果我使用的文件的扩展名不是.jar,我就不能设置ivy:buildnumber来对抗Artifactory仓库。它对我当地的工作正常。当我尝试对Artifactory进行尝试时,如果无法设置buildnumber。使用-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匹配...”并且设置了buildnumber。另一方面,如果它是其他东西,例如.zip,它会失败,如上所示。

ivy.xml文件中项目的定义是:

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

在Artifactory中,我使用maven-2默认布局创建了一个repo并包含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]

1 个答案:

答案 0 :(得分:0)

似乎带有2个字符的扩展名不会被神器拾取,它必须至少有3个字符....我也不明白为什么。