1

我使用 Jenkins 作为 CI 服务器,Apache Ivy 用于管理 Android 项目的依赖关系,Artifactory 是托管所有工件的存储库。

在 ivysettings.xml 中,配置如下所示:

  <ibiblio name="test" m2compatible="true" 
    root="http://ip:8888/artifactory/libs-snapshot-local" 
    pattern="[organisation]/[module]/1.0/[artifact]-**1.0**-SNAPSHOT.[ext]">
  </ibiblio>

在 Jenkins 中构建时,我遇到了一个错误:

BUILD FAILED
C:\.jenkins\workspace\test\build.xml:1381: impossible to publish artifacts for com.test#dummy;working@myserver: java.io.IOException: PUT operation to URL http://ip:8888/artifactory/libs-snapshot-local/com/test/dummy/1.0/project-1.0-SNAPSHOT.apk failed with status code 500: Failed to save resource 'libs-snapshot-local:com/test/dummy/1.0/project-1.0-SNAPSHOT.apk'.
    at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:82)
    at org.apache.ivy.util.url.BasicURLHandler.upload(BasicURLHandler.java:225)
    at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
    at org.apache.ivy.util.FileUtil.copy(FileUtil.java:148)
    at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
    at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
    at org.apache.ivy.plugins.resolver.RepositoryResolver.put(RepositoryResolver.java:234)
    at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
    at org.apache.ivy.plugins.resolver.ChainResolver.publish(ChainResolver.java:244)
    at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:281)
    at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:260)
    at org.apache.ivy.core.publish.PublishEngine.publish(PublishEngine.java:172)
    at org.apache.ivy.Ivy.publish(Ivy.java:600)
    at org.apache.ivy.ant.IvyPublish.doExecute(IvyPublish.java:311)
    at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:809)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 9 seconds
Finished: FAILURE

但是,当我将突出显示的“ 1.0 ”更改为“1”时,它已成功发布到 Artifactory。它看起来像点'。不被允许。还是我做错了什么?

请指教。

4

1 回答 1

1

我什至不确定您为什么可以使用 ibiblio 发布,据说它只处理依赖项解析。见:http ://ant.apache.org/ivy/history/latest-milestone/resolver/ibiblio.html

您需要一个 url 解析器来处理发布,并正确定义模式 http://ant.apache.org/ivy/history/latest-milestone/resolver/url.html

例如

<url name="test" m2compatible="true" 
  <ivy pattern="http://ip:8888/artifactory/libs-snapshot-local/[organisation]/[module]/[revision]/ivy-[revision].xml" />
  <artifact pattern="http://ip:8888/artifactory/libs-snapshot-local/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>

看起来您对版本进行了硬编码,也许可以尝试使用 [revision] 令牌

于 2016-01-04T18:22:54.130 回答