退房Gradle's documentation on multi-project builds。
下面是一個例子,有一些額外的依賴關係。只需在根文件夾中調用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'
}
HTTP:/ /stackoverflow.com/questions/2572811/gradle-make-a-3rd-party-jar-available-to-local-gradl電子資源庫 – clacke 2013-05-07 09:26:14