Just ten days after the landmark 5.0 release, we are excited to announce OpenClover 5.1.0 — and it is a big one. OpenClover now instruments modern Java: language levels 18 through 25, the Maven plugin runs on Maven 4, a long-standing multi-module build bug is finally fixed, the Java lexer got significantly faster, and the Eclipse update site can now be mirrored.
In 5.0.0 we shipped official Java 17 support and runtime compatibility with Java 21 and 25. Now we close the gap: OpenClover parses and instruments the language features introduced in Java 18, 19, 20, 21, 22, 23, 24 and 25. All these source levels are accepted by the Ant task, the Maven plugin, the command-line tools and the IDE plugins.
Pattern matching for switch and record patterns (Java 21).
Type patterns, record patterns and nested record patterns in switch are parsed and
instrumented correctly. What is more, when guards are branch-instrumented:
OpenClover reports true/false coverage for the guard expression and counts it towards cyclomatic
complexity, so a guarded case that is only ever entered one way no longer hides in your report.
Module import declarations and compact source files (Java 25).
JEP 511 (module imports) and JEP 512 (compact source files with implicitly
declared classes and instance main methods) are supported. Single-file Java programs
can now be measured just like any other source.
Flexible constructor bodies (Java 25).
JEP 513 allows statements before super() / this(). On language level 25+
OpenClover takes advantage of this and places its coverage recorder calls in the constructor
prologue, before the super() / this() call. Previously they had
to go after it, so if the superclass (or delegated) constructor threw an exception, the constructor
entry was never recorded and the code showed up as not covered even though it had been
executed. Now it is recorded correctly.
The Java lexer has been rewritten around a faster identifier-recognition path, and the numbers are good: the lexer itself is 50% faster, which translates to a ~15% speed-up of the whole parsing cycle (lexer + parser). On large codebases that is a real slice off the instrumentation phase of every build — pure win, no configuration needed. As a side effect the rewrite let us drop the BSD-licensed ANTLR Java grammar fragment (and its licence entry) from the codebase.
The plugin has been migrated to the Maven 4 API and is now built and tested against both Maven 3.3-3.9 and Maven 4.
clover:instrument and clover:instrument-tests on Maven 4:
these two goals rely on the forked-lifecycle mechanics that Maven 4 no longer supports, so they now
fail fast with a clear message instead of producing a broken build. Use
clover:setup (plus clover:aggregate and clover:clover) instead —
this is now the standard, recommended way of using the plugin on both Maven 3 and Maven 4.
maven.clover.repositoryPollutionProtection, previously off): because
clover:setup instruments sources in the main lifecycle, OpenClover will now fail the
build if it detects that an install or deploy phase is about to run
alongside it, so that instrumented artifacts never accidentally end up in your local
~/.m2 cache or, worse, get published to a shared binaries repository. If that is
genuinely what you want, switch it off with
-Dmaven.clover.repositoryPollutionProtection=false.
This one has been open for years. In a multi-module reactor build, when module B depended on module A,
the plugin could resolve A's previously installed -clover.jar from the local
.m2 cache instead of the classes just instrumented in the current build — leading to
confusing compile errors and coverage measured against outdated code. The plugin now tracks which
modules have already been built in the current reactor and uses their output directories directly.
Cross-module compile errors in multi-module projects are fixed.
Modern Jenkins ships with a strict Content Security Policy, which stripped the styling and JavaScript
out of the embedded OpenClover HTML report and made it barely usable. The plugin now publishes
the report as a downloadable ZIP archive, so you can grab it and open the fully functional
report in your browser. Crucially, this means you no longer have to loosen your Jenkins
Content Security Policy (the hudson.model.DirectoryBrowserSupport.CSP property)
just to get a readable coverage report — keep your instance locked down and still see
everything. The plugin has been updated to OpenClover 5.1.0 core.
The Eclipse plugin is now published as a proper p2 update site, which means it can be mirrored and consumed by corporate Eclipse installations and automated provisioning setups — a frequent request from users behind restrictive firewalls.
Fixed a race condition in the coverage recorder's TCP listener disconnect() logic, which
could occasionally hang or throw during shutdown of per-test coverage collection.
This is a drop-in upgrade — no changes to your configuration are required, apart from the Maven 4 note above.
Download the new Clover-for-Ant ZIP and drop the new clover.jar into your build.
Download the new update site ZIP and install it in your Eclipse via Help → Install New Software.
Download the new plugin JAR and install it via Settings → Plugins → Install Plugin from Disk.
Bump the version to 5.1.0 for both org.openclover:clover-maven-plugin
and org.openclover:clover in your pom.xml files. If you are still using
clover:instrument or clover:instrument-tests, switch to
clover:setup before moving to Maven 4.
Upgrade to the latest plugin release from the Jenkins update centre.