【发布时间】:2021-05-25 19:43:42
【问题描述】:
我目前在我的 pom.xml 中有 JaCoCo 的这个配置:
<plugin>
<!-- Maven JaCoCo Plugin configuration for Code Coverage Report -->
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<excludes>
<exclude>**/*Test.class</exclude>
</excludes>
</configuration>
当我运行 mvn clean verify site 时,我得到一个失败的构建,基于此警告(重要的是:我只有 1 个类,SayHello.scala):
Analyzed bundle 'dummy-project' with 2 classes
[WARNING] Rule violated for bundle dummy-project: classes missed count is 1, but expected maximum is 0
Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.5:check (default-check) on project dummy-project: Coverage checks have not been met. See log for details.
最后,当我检查报告时,它正在分析同一个类(唯一的区别是第二行中额外的“.”),其中一个失败了:
更新
SayHello.scala
package com.dummy
object SayHello {
def sayIt: String = "hello, world"
}
SayHelloTest.scala
package com.dummy
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
class SayHelloTest extends AnyFunSuite with Matchers {
test("SayHello says hello") {
SayHello.sayIt shouldBe "hello, world"
}
}
有人遇到过类似的问题吗?谢谢。
【问题讨论】:
标签: scala jacoco jacoco-maven-plugin