2017-12-02 216 views
0

我正在使用gradle(IDE:Intellij)來運行我的自動腳本。我有幾個模塊模塊A,模塊B,模塊C等等。我試圖將模塊B作爲從屬模塊添加到模塊C.我試過無法在gradle intellij中添加依賴項模塊

a。在模塊C中指定它build.gradle文件

b。在模塊的build.gradle文件(模塊B和模塊C)中嘗試循環引用。

c。嘗試在項目結構 - >模塊依賴關係

d。在全局build.gradle中是模塊A,B的通用文件,C

e。試過的文件|無效緩存

dependencies { 
     testCompile ":modulename" --> I tried with single quote and double quotes 
    } 

我試圖從模塊C中的模塊B類訪問類,但它是說沒有找到類。這兩個班都有公共訪問。

我還能試試嗎?

回答

0

到目前爲止,dependencies塊語法有點不對。試試這個:

project(":moduleC").dependencies { 
    testCompile project(":moduleB") 
} 
+0

它說.dependencies不能應用於「(groovy.lang.Closure)」 – Prabhath

0

得到它的工作。感謝this的帖子。

爲我工作的解決方案是在模塊的gradle特定文件,請以

dependencies{ 
    testCompile project(':moduleA').sourceSets.test.output 

} 
相關問題