I'm trying to build a Gradle JAR project that is a subproject of another and would like the output JAR file to be in a parent directory (to be specific in the "lib" directory of the parent, or sibling). How do I configure Gradle for this and where is this documented?
In build.gradle
, add:
libsDirName = '../../lib'
The config settings are shown in the official Gradle docs for the java plugin.
BTW, I fully agree with the intent behind the comments and answers given by Peter and Hiery, but sometimes the simplest solution is the best one.
Agreed with the comment Peter typed. However I think you want to express that the parent project depends on the output of the submodule. Expressing that and ensuring that the parent copies the output of the submodule to its 'lib' directory makes more sense.
task assembleSubModules(type: Copy) {
destinationDir = file("lib")
into("lib") {
project.subprojects.each { p ->
from(p.tasks.withType(Jar)*.outputs)
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With