如何添加引用project(':api')到jar gradle构建的子项目?
这是build.gradle我的主要项目。该子项目包含为git子模块,并具有类似的构建脚本。
apply plugin: 'java'
sourceCompatibility = 1.5
version = '1.0'
jar {
manifest {
attributes('Main-Class': '..........')
}
}
repositories {
mavenCentral()
}
dependencies {
compile files('libs/jfxrt.jar')
compile project(':api')
testCompile group: 'junit', name: 'junit', version: '4.11'
}
Run Code Online (Sandbox Code Playgroud)
我自己解决了。
在主jar中包含子项目的源代码:
sourceSets {
main {
java {
srcDir project(':api').file('src/main/java')
}
}
}
Run Code Online (Sandbox Code Playgroud)
在主jar中包括jar的类:
jar {
from zipTree('libs/abc.jar')
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3241 次 |
| 最近记录: |