我有一个多项目gradle项目,我正在尝试清理它,并且在可能的情况下,我想用现有的shadowjar来表达我的shadowJar依赖关系。例如,如果我有项目LibA和LibB,并且有产品Prod1,则我想基于LibA和LibB的影子罐为Prod1构建影子罐。
build.gradle文件中感兴趣的区域类似于以下示例:
project (':LibA') {
dependencies {
compile "org.glassfish:javax.json:1.0.4"
// Other 'compile' dependencies...
}
test.dependsOn("shadowJar");
shadowJar {
zip64 true
dependencies {
include(dependency("org.glassfish:javax.json:1.0.4"))
// Other 'include' dependencies...
}
}
}
project (':LibB') {
dependencies {
compile "org.glassfish:javax.json:1.0.4"
// Other 'compile' dependencies...
}
test.dependsOn("shadowJar");
shadowJar {
zip64 true
dependencies {
include(dependency("org.glassfish:javax.json:1.0.4"))
// Other 'include' dependencies...
}
}
}
project (':Prod1') {
dependencies {
compile project(':LibA')
compile project(':LibB')
compile "org.external:packageA.packageB:1.8"
// Other 'compile' dependencies...
}
test.dependsOn("shadowJar");
shadowJar {
zip64 true
dependencies {
include(.... LibA-all.jar ....) // <-- What goes here?
include(.... LibB-all.jar ....) // <-- What goes here?
include(dependency("org.external:packageA.packageB:1.8"))
// Other shadowjar 'include' dependencies...
}
}
}