我使用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>
在詹金斯建筑时,我遇到了一个错误:
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。它看起来像点'。'不被允许。或者我做的任何事都错了?
请告知。
答案 0 :(得分: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
e.g。
<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]令牌