来自fileTree的工件

时间:2015-11-11 09:32:59

标签: java gradle jar

我的gradle项目包含MavenCentral的编译和本地fileTree的编译。我尝试迭代所有依赖并打印工件信息。输出只包含maven的那些deps,而不是来自本地目录。问题是如何从fileTree打印依赖项?

dependencies {
    // The production code uses the SLF4J logging API at compile time
    compile 'org.slf4j:slf4j-api:1.7.12'
    compile 'joda-time:joda-time:+'
    compile 'log4j:log4j:1.2.17'
    compile fileTree(dir: '..\\mylibs', include: '*.jar')
}

task showConf << {
    configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
        println(artifact.moduleVersion.id.group + " " + artifact.moduleVersion.id.name + " " + artifact.moduleVersion.id.version)
    }
}

输出:

  

org.slf4j slf4j-api 1.7.12,   joda-time joda-time 2.9,   log4j log4j 1.2.17

0 个答案:

没有答案