英文:
How to generate Jacoco test report for a .jar file?
问题
以下是您提供的内容的翻译:
我对Gradle非常陌生。
我已经编写了测试套件。然而,
jacoco报告没有显示来自.jar文件的任何类
通过以下设置,jacoco在普通的java文件上运行得很好。
这是我的build.gradle:
plugins {
id 'java'
id 'jacoco'
}
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/customJacocoReportDir")
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
compile files('libs/PACV1.jar') //这是我放置jar文件的位置
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
}
jacocoTestReport.dependsOn test
如果您需要更多帮助,请随时提问。
英文:
I'm very new to Gradle.
I have written the test suites. However,
jacoco report doesn't show any classes from .jar file
With this setting below, jacoco runs very well with normal java files.
This is my build.gradle:
plugins {
id 'java'
id 'jacoco'
}
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
jacoco {
toolVersion = "0.8.5"
reportsDir = file("$buildDir/customJacocoReportDir")
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
compile files('libs/PACV1.jar') //this is where I put the jar file
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/jacocoHtml")
}
}
jacocoTestReport.dependsOn test
专注分享java语言的经验与见解,让所有开发者获益!
评论