我们正在使用eclipse和maven构建Java servlet应用程序,它们在Google Cloud平台上运行。
我们开始考虑将OpenClover集成到我们的构建中,以提供测试覆盖率和代码复杂性统计数据。
我们的一些应用程序依赖于Google库,比如com.google.cloud.spanner.Statement.Builder。当我们尝试从命令行对这些servlet运行clover时,我们会看到以下错误:
[INFO] Building auditio 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ auditio ---
[INFO]
[INFO] --- clover-maven-plugin:4.3.0:setup (default-cli) @ auditio ---
[INFO] OpenClover Version 4.3.0, built on August 03 2018 (build-1010)
[INFO] Creating new database at 'C:\.......\service\auditio\target\clover\clover.db'.
[INFO] Processing files at 1.8 source level.
[INFO] C:\...........\service\auditio\AuditIoSpanner.java:54:5:unexp
ected token: builder
[INFO] Instrumentation error
com.atlassian.clover.api.CloverException: C:\...............\service\auditio\src\main\java\com\mandm\service\aud
itio\AuditIoSpanner.java:54:5:unexpected token: builder
at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:159)
at com.atlassian.clover.CloverInstr.execute(CloverInstr.java:76)
at com.atlassian.clover.CloverInstr.mainImpl(CloverInstr.java:54)
[ERROR] Failed to execute goal org.openclover:clover-maven-plugin:4.3.0:setup (default-cli) on project auditio: Clover has fa
iled to instrument the source files in the [C:\........service\auditio\target\clover\src-instrumented] d
irectory -> [Help 1]这是在运行以下命令时:
mvn clean clover:setup test clover:aggregate clover:clover check在我们的pom.xml中包含以下内容
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.3.0</version>
<configuration>
<targetPercentage>75%</targetPercentage>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>我们运行的是JDK 1.8。
虽然我们可以排除包含这些引用的有问题的类文件,以使三叶草覆盖率正常工作,但这并不理想。没有这些特定引用的Servlets可以很好地运行clover。
谁能告诉我为什么会发生这种情况,以及是否有已知的解决方案?
提前谢谢。
发布于 2018-08-13 21:37:24
在联系OpenClover支持后,他们已经确认这是由他们最新的(4.3.0)版本中的一个bug引起的,可以在这里看到- https://bitbucket.org/openclover/clover/issues/72 -将在补丁中解决。
https://stackoverflow.com/questions/51784591
复制相似问题