2017-02-28 129 views
0

我有一個依賴構建這樣聲明與傳遞虛假的搖籃依賴繼續檢索依賴

compile ("org:module:+"){ 
    changing=true 
    transitive=false 
} 

但即使傳遞是假的,我仍然發現我的構建中一些依賴包。在生成輸出打開調試選項,我發現這條消息

[org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Visiting dependency org:module:1.21(compile) -> commons-beanutils:commons-beanutils:1.8.0(compile,runtime) 
12:19:32.773 [DEBUG] [io.spring.gradle.dependencymanagement.DependencyManagementPlugin] Processing dependency 'commons-beanutils:commons-beanutils:1.8.0' 
12:19:32.774 [DEBUG] [io.spring.gradle.dependencymanagement.DependencyManagementPlugin] No dependency management for dependency 'commons-beanutils:commons-beanutils:1.8.0' 
12:19:32.774 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Selecting new module version commons-beanutils:commons-beanutils:1.8.0 

和更多關於其他模塊的依賴關係。我必須做什麼來強制顯式不檢索這個包?

+0

你是什麼版本的Gradle?在構建腳本之後,可能會傳遞標誌被覆蓋了嗎? – ToYonos

+0

不,我發現了這個解決方案,它真的很難找到,它是一個包含在另一個包中的包,它具有傳遞性,所以即使我有這樣的想法,即我的項目正在檢索其他包依賴關係。 – mautrok

回答

1

正如你已經發現的那樣,它是另一個依賴性,它具有相同的傳遞依賴性。但是,這不應該很難找到。您可以運行Gradle內置任務dependencies以獲取所有依賴關係的樹視圖。

只是爲了保持完整性,您可以排除所有不必要的依賴關係:

configurations { 
    all*.exclude group: 'com.example', module: 'dep' 
}