2016-01-22 88 views
3

在我的多項目中,我正在根項目上運行測試任務,並期望它將在子項目上運行測試任務並生成單個測試報告。我觀察到的是,它從不對子項目運行測試任務。我期望不正確」,我需要做什麼特別的配置在我gradle這個腳本在gradle root項目上運行測試任務不會在子項目上運行測試任務

請注意,我沒有測試,在我的根項目

+0

您使用的是按需配置嗎?對根項目和子項目的測試任務是否具有完全相同的名稱? – RaGe

+0

我沒有使用「按需配置」功能,並且使用默認任務名稱「測試「在所有項目中,謝謝。 –

回答

3

我認爲,從Gradle User Guide該段應幫助你:。

subprojects { 
    apply plugin: 'java' 

    // Disable the test report for the individual test task 
    test { 
     reports.html.enabled = false 
    } 
} 

task testReport(type: TestReport) { 
    destinationDir = file("$buildDir/reports/allTests") 
    // Include the results from the `test` task in all subprojects 
    reportOn subprojects*.test 
} 
相關問題