【问题标题】:How to build on travis-ci with gradle and cobertura如何使用 gradle 和 cobertura 在 travis-ci 上构建
【发布时间】:2014-12-14 00:48:33
【问题描述】:

今天我尝试使用 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']

【问题讨论】:

    标签: gradle travis-ci cobertura coveralls


    【解决方案1】:

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

    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.0'
        }
    }
    
    apply plugin: 'com.github.kt3k.coveralls'
    

    你可以看到我用过的整个build.gradle here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多