ivy:如果文件扩展名/类型不是.jar,那么buildnumber将失败



我正在试验Ivy 2.3.0、Artifactory 3.0.3和Ant。问题是,如果我使用的文件扩展名不是.jar,我就不能将ivy:buildnumber设置为针对Artifactory repo。它对我的本地文件很有效。当我尝试对抗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文件中项目的定义为:

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

在Artifactory中,我创建了一个带有maven-2默认布局的repo,其中包含testmod。

我的蚂蚁目标包含:

<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]

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

相关内容

  • 没有找到相关文章

最新更新