无法重现您的问题。使用的是什么版本的 ivy?
例子
使用了以下软件版本:
Apache Ant(TM) version 1.8.2
Apache Ivy 2.3.0-rc2
构建.xml
<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>
常春藤.xml
<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>