我遇到了一件奇怪的事。我使用常春藤检索标签将jar放到某处。如果我编写如下代码:
<target name="test">
<ivy:retrieve pattern="lib/[artifact](.[ext])" sync="true" type="jar" conf="webInfLib"/>
</target>
工作正常。但如果我添加如下内容:
<target name="test">
<ivy:cachepath pathid="ivy.path" />
<ivy:retrieve pattern="lib/[artifact](.[ext])" sync="true" type="jar" conf="webInfLib"/>
</target>
它会抛出“无法解决依赖关系”。有什么建议?感谢。
答案 0 :(得分:0)
无法重现您的问题。什么版本的常春藤正在使用?
使用以下软件版本:
Apache Ant(TM) version 1.8.2
Apache Ivy 2.3.0-rc2
<project name="demo" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="init" description="Use ivy to resolve classpaths">
<ivy:cachepath pathid="ivy.path" />
<ivy:retrieve pattern="lib/[artifact](.[ext])" sync="true" type="jar" conf="webInfLib"/>
</target>
<target name="build" depends="init" description="build project">
</target>
<target name="clean" description="Cleanup build files">
<delete dir="lib"/>
</target>
<target name="clean-all" depends="clean" description="Additionally purge ivy cache">
<ivy:cleancache/>
</target>
</project>
<ivy-module version="2.0">
<info organisation="com.myspotontheweb" module="demo"/>
<configurations>
<conf name="webInfLib" description="add jar to web-inf/lib folder"/>
</configurations>
<dependencies>
<dependency org="javax.servlet" name="servlet-api" rev="2.4" conf="webInfLib->default"/>
</dependencies>
</ivy-module>