Dependencies 常春藤-获得跨多个项目的模块及其修订的平面列表

Dependencies 常春藤-获得跨多个项目的模块及其修订的平面列表,dependencies,report,ivy,dependency-management,Dependencies,Report,Ivy,Dependency Management,我们使用Ivy来管理我们的库依赖关系,我们需要创建一个关于所有模块及其在特定配置中的修订的报告,并将其合并到大约30个项目中。只是一个简单的列表,其中没有依赖项 “某些配置”指的是我们在ivy.xml文件中使用配置“编译”、“运行时”、“测试”,我们只想包括“编译”和“运行时”,因为我们只对产品实际附带的库列表感兴趣 我熟悉这个任务,我们使用它为每个项目生成HTML报告。当然,可以选择使用此输出并对其进行解析,或者使用XSLT实现所需的报告格式。然而,我想知道是否有更简单的方法 谢谢 该任务可用

我们使用Ivy来管理我们的库依赖关系,我们需要创建一个关于所有模块及其在特定配置中的修订的报告,并将其合并到大约30个项目中。只是一个简单的列表,其中没有依赖项

“某些配置”指的是我们在ivy.xml文件中使用配置“编译”、“运行时”、“测试”,我们只想包括“编译”和“运行时”,因为我们只对产品实际附带的库列表感兴趣

我熟悉这个任务,我们使用它为每个项目生成HTML报告。当然,可以选择使用此输出并对其进行解析,或者使用XSLT实现所需的报告格式。然而,我想知道是否有更简单的方法

谢谢

该任务可用于生成一个XML文件,详细说明配置中的工件:

<ivy:artifactreport tofile="build/runtime.xml" conf="runtime"/>

这里有一个稍微不同的解决方案,它结合了Java和ivy任务,根据编译依赖项生成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>

导入groovy.xml.MarkupBuilder
//
//生成类路径文件
//
//“lib”classpathentry字段使用ivy工件报告填充
//
project.log(“Creating.classpath”)
新文件(“.classpath”)。带writer{writer->
def xml=新的MarkupBuilder(编写器)
xml.classpath(){
classpathentry(种类:“src”,路径:args[0])
classpathentry(种类:“输出”,路径:args[1])
classpathentry(种类:“con”,路径:“org.eclipse.jdt.launching.JRE_容器”)
project.references.libfiles.each{
classpathentry(种类:“lib”,路径:it)
}
}
}