我正在尝试创建一个gradle项目,它将一些依赖项组合在一个混淆的jar中(现在,我不关注混淆部分) . 这些依赖项是其他gradle项目,在settings.gradle中定义 .
My project does not contain any code directly.
我正在尝试使用shadowJar插件生成包含依赖项的"fat" jar . I want this jar to be the default output jar of the project (replace the jar task ?).
目标是能够使用 compile project(:'MyCombinedProject')
将此组合项目添加为其他项目的依赖项,这将添加生成的胖jar作为依赖项 .
我的build.gradle:
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '1.2.2'
}
repositories {
mavenCentral()
}
jar {
/* Here I want to replace the jar task with the shadowjar */
}
dependencies {
compile project(':MyProject1')
compile project(':MyProject2')
testCompile group: 'junit', name: 'junit', version: '4.11'
}
我的项目路径在 settings.gradle
中定义 .