【发布时间】:2016-09-22 01:15:33
【问题描述】:
使用 Ant Ivy 构建,我试图将我的 jar 分成一个配置用于 3rd 方 jar,另一个配置用于我构建和发布的 jar。 ProjectA 使用 3rd 方 jar 并构建 ProjectB 所依赖的 jar,但是当我使用 Ant Ivy confs 时,我无法让 ProjectB 检索 ProjectA jar。
当我为 ProjectB 执行 ant 脚本时,它可以很好地构建 ProjectA。 ProjectA 构建将一个 jar 发布到本地存储库。 ProjectB 从公共存储库中检索必要的 jar 没有问题,但是当它尝试检索 ProjectA jar 时,它说 UNRESOLVED DEPENDENCY: testproject#ProjectA;2.0.0: configuration not found in testproject#ProjectA;2.0.0 :'本地罐'。 testproject#ProjectB;2.0.0 localjars 需要它
如果我删除对第二个配置 localjars 的所有引用,并且只对所有内容使用默认值,它就可以正常工作。不过,我真的需要将我的罐子分类到不同的 confs 中。
我已成功使用从 ant 脚本传递的修订值代替下面的“2.0.0”并用 ${revision} 引用,但 conf 错误是相同的。
ProjectA ivy.xml(为简洁起见,包含依赖项的子集):
<ivy-module version="2.0">
<info organisation="testproject" module="ProjectA" revision="2.0.0" status="release" publication="20160524124555"/>
<configurations>
<conf name="default" transitive="false" visibility="public"/>
<conf name="localjars" extends="default" visibility="public"/>
</configurations>
<publications>
<artifact name="projectA-jar-2.0.0" type="jar" conf="localjars" ext="jar"/>
</publications>
<dependencies>
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.7.0" conf="default->master"/>
<dependency org="commons-collections" name="commons-collections" rev="3.1" conf="default->master"/>
</dependencies>
</ivy-module>
ProjectA build.xml 发布目标:
<target name="publish" depends="package"
description="--> compile test and publish this project in the local ivy repository">
<ivy:publish artifactspattern="${DEPLOY_DIR_LIB}/[artifact].[ext]"
resolver="local" pubrevision="2.0.0" status="release"
srcivypattern="${ivy.dep.file}" forcedeliver="true" overwrite="true" conf="localjars,default"/>
<echo message="project ${ant.project.name} released with version 2.0.0" />
</target>
ProjectB ivy.xml:
<ivy-module version="2.0">
<info organisation="testproject" module="ProjectB" revision="2.0.0" status="release" publication="20160524103113"/>
<configurations>
<conf name="default"/>
<conf name="localjars" extends="default"/>
</configurations>
<publications>
<artifact name="projectB-2.0.0" conf="localjars" type="jar" ext="jar"/>
</publications>
<dependencies>
<dependency org="testproject" name="ProjectA" rev="${revision}" transitive="true" conf="localjars->localjars; default->default"/>
</dependencies>
ProjectB Ant 解析目标:
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve pattern="${DEPLOY_DIR_LIB}/[artifact]-2.0.0.[ext]" revision="2.0.0" conf="localjars" />
</target>
知道有什么问题吗?谢谢!
帕特里克
【问题讨论】: