Ant + Ivy:无法检索传递依赖项

时间:2016-05-27 20:21:03

标签: java maven ant nexus ivy

我有两个项目,app1和app2。

app2取决于app1(app2-> app1)。

app1的build.xml就像

<target name="deploy" depends="jar">
        <ivy:deliver deliverpattern="${build.dir}/ivy.xml" pubrevision="${ivy.revision}" status="release" />
        <ivy:makepom ivyfile="${build.dir}/ivy.xml" pomfile="${build.dir}/${ivy.module}.pom" />
        <ivy:resolve />
        <ivy:publish resolver="nexus-snapshots" pubrevision="${ivy.revision}" overwrite="true" publishivy="false">
            <artifacts pattern="${build.dir}/[artifact].[ext]" />
        </ivy:publish>
    </target>

app1的ivy.xml就像这样

<ivy-module version="2.0">
    <info organisation="the.bhushan" module="app1" revision="1.0-SNAPSHOT" />
    <publications>
        <artifact name="app1" type="jar" />
        <artifact name="app1" type="pom" />
    </publications>
    <dependencies>
        <dependency org="commons-cli" name="commons-cli" rev="1.0" />
        <dependency org="net.lingala.zip4j" name="zip4j" rev="1.3.1" />
    </dependencies>
</ivy-module>

app2的ivy.xml就像

<ivy-module version="2.0">
    <info organisation="the.bhushan" module="app2" revision="1.0-SNAPSHOT" />
    <configurations>
        <conf name="compile" visibility="public" />
    </configurations>
    <dependencies>
        <dependency org="the.bhushan" name="app1" rev="1.0-SNAPSHOT" />
    </dependencies>
</ivy-module>

现在的问题是,在app2中,瞬态依赖关系没有得到检索(即commons-cli和zip4j)。

更新:我查看了app1创建的pom。其中,所有依赖项都有<optional>true</optional>元素。

0 个答案:

没有答案