0

We’re building Java servlet apps using eclipse and maven which run in the Google Cloud Platform.

We are starting to look at integrating OpenClover into our builds to provide test coverage and code complexity statistics.

Some of our apps have dependencies on Google libraries, such as com.google.cloud.spanner.Statement.Builder. When we try and run clover from the command line against these servlets we see the following errors:

[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]

This is when running the following command:

mvn clean clover:setup test clover:aggregate clover:clover check

With the following in our 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>

We’re running JDK 1.8.

While we can exclude the offending class files that contain these references to get the clover coverage to work, that isn’t ideal. Servlets that do not have these specific references will run clover just fine.

Can anyone advise why this might be occurring and if there is a known resolution?

Thanks in advance.

1
  • That's impossible to tell what's going on without a code snippet showing off what exactly Clover can't instrument. But wild guess. Since there's 'builder' reference, potentially that's a Lombock or other code generation tool you're using which is causing problems with Clover. As side note, you can turn off instrumentation for specific lines of code //CLOVER:OFF //CLOVER:ON confluence.atlassian.com/clover/…
    – grzlew
    Aug 13, 2018 at 9:02

1 Answer 1

0

After reaching out to OpenClover support they have confirmed that this is caused by a bug in their latest (4.3.0) release as can be seen here - https://bitbucket.org/openclover/clover/issues/72 - and will be resolved in a patch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.