如何用gradle和cobertura构建travis-ci

时间:2014-10-18 16:20:40

标签: gradle travis-ci cobertura coveralls

今天,我尝试使用cobertura报告将我的travis-ci与工作服联系起来。在将cobertura添加到我的项目后,不幸的是,travis无法成功构建我的项目。

以下是示例性版本:https://travis-ci.org/bandrzejczak/activiti-console-rest/jobs/38356310

这是我的build.gradle文件:

plugins {
    id 'java'
    id 'war'
    id 'idea'
    id 'net.saliman.cobertura' version '2.2.5'
    id 'com.github.kt3k.coveralls' version '2.0.1'
}

sourceCompatibility = 1.7
version = '0.0.1'

repositories {
    mavenCentral()
    maven{
        url 'http://maven.restlet.org'
    }
}

dependencies {
    //compile dependencies
    compile group: 'org.jetbrains', name: 'annotations', version: '13.0'
    compile group: 'org.activiti', name: 'activiti-engine', version: '5.15.1'
    compile group: 'org.activiti', name: 'activiti-spring', version: '5.15.1'
    compile group: 'org.restlet.jee', name: 'org.restlet', version: '2.2.1'
    compile group: 'org.restlet.jee', name: 'org.restlet.ext.spring', version: '2.2.1'
    compile group: 'org.restlet.jee', name: 'org.restlet.ext.jackson', version: '2.2.1'
    compile group: 'org.reflections', name: 'reflections', version: '0.9.8'
    compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.6'

    //runtime dependencies
    runtime group: 'mysql', name: 'mysql-connector-java', version: '5.1.31'

    //test dependencies
    testCompile group: 'junit', name: 'junit', version: '4.11'
    testCompile group: 'org.springframework', name: 'spring-test', version: '3.2.7.RELEASE'
    testCompile group: 'com.google.code.gson', name: 'gson', version: '2.3'
    testRuntime group: 'com.h2database', name: 'h2', version: '1.4.178'
    testRuntime group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
}

cobertura.coverageFormats = ['html', 'xml']

1 个答案:

答案 0 :(得分:0)

我找到了问题的答案,但我忘记在这里发布。我的错误来自使用错误的工作服插件。这是您在遇到此类问题时需要使用的内容:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.0'
    }
}

apply plugin: 'com.github.kt3k.coveralls'

您可以看到我使用here的整个build.gradle