artifactreportタスクを使用して、構成内のアーティファクトの詳細を示す XML ファイルを生成できます。
<ivy:artifactreport tofile="build/runtime.xml" conf="runtime"/>
これは、 groovyタスクとivy cachefilesetタスクを組み合わせて、コンパイルの依存関係に基づいて Eclipse の「.classpath」ファイルを生成する、わずかに異なるソリューションです。
<macrodef name="eclipse">
<attribute name="srcdir"/>
<attribute name="outputdir"/>
<attribute name="classpathref" default="build.path"/>
<attribute name="conf" default="compile"/>
<sequential>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="@{classpathref}"/>
<ivy:cachefileset setid="libfiles" conf="@{conf}"/>
<groovy>
<arg value="@{srcdir}"/>
<arg value="@{outputdir}"/>
import groovy.xml.MarkupBuilder
//
// Generate the classpath file
//
// The "lib" classpathentry fields are populated using the ivy artifact report
//
project.log("Creating .classpath")
new File(".classpath").withWriter { writer ->
def xml = new MarkupBuilder(writer)
xml.classpath() {
classpathentry(kind:"src", path:args[0])
classpathentry(kind:"output", path:args[1])
classpathentry(kind:"con", path:"org.eclipse.jdt.launching.JRE_CONTAINER")
project.references.libfiles.each {
classpathentry(kind:"lib", path:it)
}
}
}
</groovy>
</sequential>
</macrodef>