查看Gradle 关于多项目构建的文档。
这是一个示例,带有一些额外的依赖项。只需调用gradle install
根文件夹,所有内容都将被构建并放入您的本地仓库。
文件夹结构:
root
+--> build.gradle
+--> settings.gradle
+--> sdk
| +--> build.gradle
+--> example
+--> build.gradle
根/build.gradle:
allprojects {
apply plugin: 'java'
apply plugin: 'maven'
group = 'myGroup'
version = '0.1-SNAPSHOT'
}
根/settings.gradle:
include 'sdk'
include 'example'
根/sdk/build.gradle:
dependencies {
// just an example external dep.
compile group:'commons-lang', name:'commons-lang', version:'2.3'
}
根/示例/build.gradle:
dependencies {
compile project(':sdk')
compile group:'log4j', name:'log4j', version:'1.2.16'
}