2016-08-19 79 views
1

有沒有人在將gradle-clover-plugin與Grails 3集成方面有成功?我與的build.gradle得到的最接近的是:Grails 3:gradle-clover-plugin集成

clover { 
    additionalSourceDirs = [new File("src/main/groovy"), new File("grails-app")] as Set 
    additionalTestDirs = [new File("src/test/groovy/"), new File("src/integration-test/groovy")] as Set 
    includes = ['/*.groovy', '/.java'] 
    testIncludes = ['/Spec.java'] 
    report { 
     html = true 
     xml = true 
    } 
} 

Grails的測試程序:

[clover-clean] Clover Version 3.2.0, built on October 21 2013 (build-908) 
[clover-clean] Loaded from: C:\Users\abc3\.gradle\caches\modules-2\files-2.1\com.cenqua.clover\clover\3.2.0\e09feecf14644d92003ab037c30e483cf86b3e82\clover-3.2.0.jar 
[clover-clean] Clover: Commercial License registered to Abc Inc. 
[clover-setup] Clover Version 3.2.0, built on October 21 2013 (build-908) 
[clover-setup] Loaded from: C:\Users\abc3\.gradle\caches\modules-2\files-2.1\com.cenqua.clover\clover\3.2.0\e09feecf14644d92003ab037c30e483cf86b3e82\clover-3.2.0.jar 
[clover-setup] Clover: Commercial License registered to Abc Inc. 
[clover-setup] Clover is enabled with initstring 'C:\Users\abc3\MyApp\build/.clover/clover.db-test' 
[javac] : warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
[javac] : warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
[copy] Copied 2 empty directories to 2 empty directories under C:\Users\abc3\MyApp\build\classes\main 
[copy] Copied 2 empty directories to 2 empty directories under C:\Users\abc3\MyApp\build\classes\test 
[move] Moving 14 files to C:\Users\abc3\MyApp\build\classes 
[move] Moved 3 empty directories to 1 empty directory under C:\Users\abc3\MyApp\build\classes 
[move] Moving 4 files to C:\Users\abc3\MyApp\build\classes 
[move] Moved 3 empty directories to 1 empty directory under C:\Users\abc3\MyApp\build\classes 
:compileIntegrationTestJava UP-TO-DATE 
:compileIntegrationTestGroovy UP-TO-DATE 
:processIntegrationTestResources UP-TO-DATE 
:integrationTestClasses UP-TO-DATE 
:integrationTest UP-TO-DATE 
:mergeTestReports UP-TO-DATE 

三葉草似乎運行,但我沒有得到任何報告。

C:\ Users \ abc3 \ MyApp \ build/.clover中沒有創建任何內容。我沒有.clover目錄。

  • Grails的版本:3.1.10
  • Groovy的版本:2.4.7
  • JVM版本:1.8.0_71

任何想法?

由於

馬克

回答

0

Grails的-三葉草插件的工作原理使用Grails 1和2,其基於甘特。 Grails 3基於Gradle,所以插件不兼容。

對於Grails 3我會嘗試在Gradle構建腳本中編寫Clover-Gradle集成,而不是嘗試採用grails-clover-plugin。

請看看代碼片段最近公佈的這個頁面上:

https://confluence.atlassian.com/display/CLOVER/Gradle+Clover+Plugin

0

我用Gradle-Clover-Plugin爲一個Grails 3.2.4應用程序(用搖籃3.0包裝)。這是工作,而我在build.gradle文件所做的是:

首先添加類路徑依賴:

buildscript { 
    dependencies { 
     classpath 'com.bmuschko:gradle-clover-plugin:2.1.0' 
    } 
} 

然後應用插件:

apply plugin: 'com.bmuschko.clover' 

然後加入三葉草依賴性:

dependencies { 
    clover 'org.openclover:clover:4.2.0' 
} 

然後添加一些配置:

clover { 
    // Although Clover is now open source the plugin 
    // still expects to find the license file. 
    // Any file will work. 
    licenseLocation = File.createTempFile('clover', '.license').absolutePath 

    // This is neededed to see which tests targeted code 
    // In this particular project I'm only using Spock 
    // specifications 
    testIncludes = ['**/*Spec.groovy'] 

    // I would like to have both html and xml report 
    report { 
     html = true 
     xml = true 
    } 
} 

最後執行:

./gradlew cloverGenerateTestReport 
0

我可以使它使用Grails 3.3.2和4.4 gradle這個工作,但它是一個乏味的任務。這是我做的:

  1. gradle。性能

    grailsVersion=3.3.2 gormVersion=6.1.8.RELEASE gradleWrapperVersion=4.4 org.gradle.jvmargs=-Xms256m -Xmx2048m

  2. 的build.gradle

    apply plugin: 'java' 
    apply plugin: 'com.bmuschko.clover' 
    
    dependencies { 
        clover 'org.openclover:clover:4.2.0' 
        ... 
        compile 'org.codehaus.groovy:groovy-all:2.4.7' 
        ... 
    } 
    
    sourceSets.main.output.classesDir = new File(buildDir, "classes/main") 
    integrationTest.testClassesDirs = sourceSets.integrationTest.output.classesDirs 
    
    clover { 
        licenseLocation = File.createTempFile('clover', '.license').absolutePath    
    
        excludes = ['**/Application.groovy',  
           '**/BootStrap.groovy', 
           '**/UrlMappings.groovy', 
           '**/*GrailsPlugin.groovy', 
           '**/*Mock.groovy', 
        ] 
    
        testIncludes = ['**/*Spec.groovy'] 
        report { 
         html = true 
         xml = true 
        } 
    } 
    

我希望這會幫助你。