IVY通过常春藤延伸:解决

时间:2014-08-05 17:04:07

标签: caching ivy extends

我们最近在构建系统中引入了一个公共依赖项,它在每个单独的ivy.xml中使用ivy:extends选项。常见的ivy.xml内容如下;

共的ivy.xml

<?xml-stylesheet type="text/xsl" href="http://repository.xyz.com/xsl/version-doc.xsl"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation="XYZ" branch="MAIN" module="CommonDependencies" revision="1.0.0" />

    <configurations defaultconfmapping="test->test(*);compile->compile(*);package->package(*)">
        <conf name="test" description="Test Time dependencies"/>
        <conf name="compile" description="Build Time dependencies"/>
        <conf name="package" description="Distributable dependencies" />
    </configurations>

    <dependencies>
        <dependency org="junit" name="junit" rev="4.8.2" conf="compile,test"/>
        <dependency org="apache" name="wss4j" rev="1.5.10" conf="compile,test" />
        <dependency org="spring" name="spring" rev="2.5.6" conf="compile" />
        <dependency org="apache" name="commons-pool" rev="1.5.5" conf="compile" />
        <dependency org="google" name="gtest" rev="1.5.0" conf="test" >
            <artifact name="gtest" type="" ext="zip" conf="test" />
        </dependency>
        <dependency org="NUnit" name="NUnit" rev="2.6" conf="test">
            <artifact name="NUnit" type="" ext="zip" conf="test" />
        </dependency>
        <dependency org="javax" name="javaee-api" rev="6.0" conf="compile,test" />
    </dependencies>
</ivy-module>

我有大约120个项目扩展上面显示的常见常春藤以获得它们的依赖关系如下;

的ivy.xml

<?xml-stylesheet type="text/xsl" href="http://repository.xyz.com/xsl/version-doc.xsl"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info module="Module1" >
        <extends extendType="all"
                     organisation="XYZ"
                     module="CommonDependencies"
                     revision="1.0.0" />
    </info>

    <publications />

    <!-- Define Additional Dependencies Below -->
    <dependencies />
</ivy-module>

如果您发现要求不使用location的{​​{1}}属性,因为这需要路径解析,这使得所有子项目都是一定的顺序等。为了实现这一点,我们在开始时解决了一般的依赖关系将已解决的 - *。xml生成到我们的本地IVY缓存中,现在希望IVY为所有与以下消息崩溃的子项目解析相同的内容;

extends

我可以清楚地看到公共依赖关系已成功解决并可在本地缓存中使用.....我如何让Override ignored for property "ivy.buildlist.dir" Overriding previous definition of property "ivy.version" [ivy:buildlist] WARN: Unable to parse included ivy file ../ivy.xml: D:\Source\RTC-DS\Dev\ivy.xml (The system cannot find the file specified) in fil e:/D:/Source/RTC-DS/ivy.xml [ivy:buildlist] main: Checking cache for: dependency: XYZ#CommonDependencies;1.0.0 {} [ivy:buildlist] don't use cache for XYZ#CommonDependencies;1.0.0: checkModified=true [ivy:buildlist] don't use cache for XYZ#CommonDependencies;1.0.0: checkModified=true [ivy:buildlist] tried C:\Users\sjunejo\.ivy2/publish/ivys/XYZ/CommonDependencies-1.0.0.xml [ivy:buildlist] tried C:\Users\sjunejo\.ivy2/publish/XYZ/CommonDependencies/CommonDependencies-1.0.0-jar.jar [ivy:buildlist] publisher: no ivy file nor artifact found for XYZ#CommonDependencies;1.0.0 [ivy:buildlist] don't use cache for XYZ#CommonDependencies;1.0.0: checkModified=true [ivy:buildlist] tried C:\Users\sjunejo/external/XYZ/CommonDependencies/CommonDependencies-1.0.0.jar [ivy:buildlist] external-local-resolver: no ivy file nor artifact found for XYZ#CommonDependencies;1.0.0 [ivy:buildlist] don't use cache for XYZ#CommonDependencies;1.0.0: checkModified=true [ivy:buildlist] tried http://repository.XYZ.com/ivyrep/ivys/XYZ//CommonDependencies-1.0.0.xml [ivy:buildlist] CLIENT ERROR: Not Found url=http://repository.XYZ.com/ivyrep/ivys/XYZ//CommonDependencies-1.0.0.xml [ivy:buildlist] tried http://repository.XYZ.com/ivyrep/XYZ//CommonDependencies/CommonDependencies-1.0.0-jar.jar [ivy:buildlist] CLIENT ERROR: Not Found url=http://repository.XYZ.com/ivyrep/XYZ//CommonDependencies/CommonDependencies-1.0.0-jar.j ar [ivy:buildlist] XYZ-http-resolver: no ivy file nor artifact found for XYZ#CommonDependencies;1.0.0 [ivy:buildlist] don't use cache for XYZ#CommonDependencies;1.0.0: checkModified=true [ivy:buildlist] tried http://repository.XYZgroup.com/external/XYZ/CommonDependencies/CommonDependencies-1.0.0.jar [ivy:buildlist] CLIENT ERROR: Not Found url=http://repository.XYZgroup.com/external/XYZ/CommonDependencies/CommonDependencies-1.0.0.jar [ivy:buildlist] external-http-resolver: no ivy file nor artifact found for XYZ#CommonDependencies;1.0.0 [ivy:buildlist] WARN: Unable to parse included ivy file for XYZ#CommonDependencies;1.0.0 BUILD FAILED 查看本地缓存以找到这个...我已经到处搜索了它似乎我必须使用<ivy:resolve /> :(属性而不是依赖于IVY缓存。

此外,当我从公共依赖项中删除location时,它会解析为revision,其中IVY 2.2.0似乎以某种方式解决并且我的所有项目都正常工作但是IVY 2.3.0抱怨因为它是尝试解决子项目的ivy.xml中定义的 revision = 1.0.0 及其强制性,否则IVY立即崩溃,说明working@...revision的强制属性。< / p>

2 个答案:

答案 0 :(得分:0)

确定没有其他方法可以解决此问题,但可以使用location中的extends属性。我通过提供像location=${common.ivy.location}这样的属性解决了这个问题,并在我的常春藤设置中声明了这个属性,它就像一个魅力。

此解决方案适用于IVY 2.2,2.3和2.4。

答案 1 :(得分:-2)

同意SJunejo的回复。在我的情况下,我从2.2.0移动到2.3.0后得到了同样的错误,我正在使用location属性。然而,我使用的是相对路径。当我更新为使用绝对路径时,错误就消失了。

编辑:挖到常春藤的源头。 2.3.0不能使用相对路径,只有绝对值和2.2.0没有对此位置属性进行属性替换,因此必须保留2.2的相对路径,因为它不会替换我的根路径属性。有点让人难以来回查看升级是否有效: - (