Gradle将多个依赖项提取到不同的目录
我正在尝试将多个依赖项提取到不同的目录中。 我尝试了以下内容。
configurations { cppDependencies } dependencies { cppDependencies 'com.group:artifact1:1.0" cppDependencies 'com.group:artifact2:1.0" } task extractDeps(type: Copy) { from { configurations.cppDependencies.collect { zipTree(it) } } into new File(buildDir, "DEP_DIR") }
显然,这只是在同一个DEP_DIR目录下提取artifact1和artifact2 。 但我真正想要实现的是分别在DEP_DIR / artifact1和DEP_DIR / artifact2下提取它们。
我试图在zipTree命令下放入新文件(buildDir,“DEP_DIR /”+ it.artifactId) ,但它给出了一个错误。
这可能吗?
我找到了一个有效的解决方
不知道这是不是最好的方式,但这就是我想出的:
task extractDeps << { configurations.cppDependencies.resolvedConfiguration.resolvedArtifacts.each { artifact -> copy { from project.zipTree(artifact.getFile()) into new File(project.buildDir, "DEP_DIR/" + artifact.name) } } }
- 如何重用gradle-wrapper?
- Intellij资源不在构建工件中
- Maven的档案相当于Gradle
- 如何为Android Studio打包和链接OpenCV binares和OpenCV Java SDK?
- 如何将本地.jar文件依赖项添加到远程存储库?
- 如何添加注释以从jacoco代码覆盖率报告中排除方法?
- Gradle Build失败并出现exception:java.exe’以非零退出值2结束
- 使用`Runtime.getRuntime()。exec`从Java启动的进程无法访问文件系统位置
- Android Studio 2.3错误:无法加载“com.google.common.collect.ImmutableSet”类