我有兩個項目的gradle定義,像這樣的IntelliJ-想法gradle這個子模塊保持不忘根項目依賴
apiclient (root) | src\ | build.gradle |--- android (module) | src\ | build.gradle
這些項目是不是行家,但和模塊apiclient.android取決於根模塊(apiclient)。
我繼續使用項目結構...添加apiclient - >相關性對話和基準不斷得到來自.iml文件中刪除,每當我在gradle這個工具窗口中單擊刷新。
我怎能忘記父模塊依賴子模塊?
編輯:作爲請求的build.gradle文件。
apiclient的build.gradle
group 'emby.apiclient'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.11'
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'com.google.guava:guava:18.0'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
}
apiclient.android的build.gradle
group 'emby.apiclient'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.codehaus.groovy:groovy-all:2.3.11'
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'com.google.code.gson:gson:2.5'
compile 'com.mcxiaoke.volley:library:1.0.16'
compile 'com.squareup.okhttp:okhttp:2.1.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.1.0'
compile 'emby.apiclient:apiclient:1.0-SNAPSHOT'
}
最後一行compile 'emby.apiclient:apiclient:1.0-SNAPSHOT'
在gradle這個項目窗口紅色下劃線。我也試過compile project 'apiclient'
,結果沒有變化。
settings.gradle
rootProject.name = 'apiclient'
include 'android'
findProject(':android')?.name = 'emby.apiclient.android'
你是不是在管理的gradle的依賴,你可以展示你的build.gradle文件?用build.gradle文件更新了 – RaGe
。 – Redshirt
您需要包括在settings.gradle文件的子項目,讓gradle這個現在是建立一個多項目建設 – Dummy