[英]Gradle subproject dependency
I am most definitely a gradle newbie [trying to teach myself]; 我绝对是一个傻瓜新手[试图自学]; thought I'd start with what I thought would be an extremely simple excercise!
以为我会从我认为非常简单的运动开始! I have a main project (rootproj), and 2 subprojects (mysub and othersub).
我有一个主项目(rootproj)和2个子项目(mysub和othersub)。 I have managed to get the compile/build step working ok ... the jar files get created.
我设法让编译/构建步骤正常工作......创建了jar文件。 Now I need to copy the jar files into a predefined/existing folder tree, before tar/gzip'ing the folder tree.
现在我需要在tar / gzip文件夹树之前将jar文件复制到预定义/现有文件夹树中。 This is where I get stuck ... cannot figure out how to call the 'tasks' to copy the jar files.
这就是我被卡住的地方......无法弄清楚如何调用'任务'来复制jar文件。
Here's my settings.gradle and build.gradle file contents:- 这是我的settings.gradle和build.gradle文件内容: -
include 'othersub'
include 'mysub'
include 'rootproj'
apply plugin: 'java'
dependencies {
compile project(':mysub')
compile files('ext_lib/commons-lang3-3.5.jar')
...
compile files('ext_lib/jsonjava.jar')
}
jar {
archiveName 'myjar.jar'
}
task copymyjars(type: Copy) {
println 'In copymyjar'
from 'build/libs/myjar.jar'
from 'mysub/build/libs/mysub.jar'
into '../mydir/lib'
}
task copyotherjar(type: Copy) {
println 'In copyotherjar'
from 'othersub/build/libs/othersub.jar'
into '../mydir/other/lib'
}
copymyjars.dependsOn ":.build"
copyotherjar.dependsOn ":othersub.build"
apply plugin: 'java'
jar {
archiveName 'othersub.jar'
}
No doubt I'm doing something stupid, but what is it? 毫无疑问我做了一些愚蠢的事,但它是什么?
task copymyjars(type: Copy, dependsOn :[jar]) {
from 'build/libs/myjar.jar'
from 'mysub/build/libs/mysub.jar'
into '../mydir/lib'
}
Depend on Jar
task, and then copy your jars
to your directory 依赖于
Jar
任务,然后将您的jars
复制到您的目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.