我知道在 stackexchange 上有很多类似的问题,但这让我发疯,任何其他答案都没有帮助我。我几乎使用了我能找到的所有 gradle 强制标志。
我的 Gradle 版本是 2.2.1
我的构建.gradle
buildscript {
ext {
springBootVersion = '1.5.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("se.transmode.gradle:gradle-docker:1.2")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
apply plugin: 'docker'
apply plugin: 'jacoco'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
ext {
springCloudVersion = 'Dalston.RELEASE'
}
test {
include 'src/test/java'
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.enabled false
xml.destination "${buildDir}/jacoco"
}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
当我跑步时gradle test
or gradle clean test jacocoTestReport
or gradle clean --re-run
等等我得到相同的结果。
gradle test
:compileJava
:processResources
:classes
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test UP-TO-DATE
:jacocoTestReport SKIPPED
我在 src/test/java 位置只有 1 个测试。
为什么它不会生成报告并运行?我不知所措。
删除测试配置中错误的 include 语句。
这似乎导致测试任务始终是最新的(不执行任何测试,因为包含模式不匹配)
The jacocoTestReport
如果没有则跳过execution data
生成报告所需的可用信息。这execution data
应生成同时test
任务被执行。在你的例子中我们看到test
任务始终标记为最新(因为包含语句无效),导致构建永远不会为该任务生成任何输入jacocoTestReport
task.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)