Warning about older Clovered artifact version during multi-module Maven build
Symptoms
Multi-module Maven build. Instrumentation by 'clover:instrument'. Warning during build as follows:
Using <artifact name>, built on <timestamp> even though a Clovered version exists but it's older (lastModified: <timestamp>)
and could fail the build. Please consider running Clover again on that dependency's project.
Cause
When Clover is used with 'clover:instrument' goal, it forks a parallel build process. Thus build produces two versions of artifacts:
- with Clover instrumentation having a "-clover" suffix
- without Clover instrumentation having original name
In case of multi-module build, Clover performs extra check of artifact timestamp. If the found clovered version is older than the non-clovered one we need to use the non-clovered version. This is to handle use case such as:
- Say you have a module B that depends on a module A
- You run Clover on A
- You make modifications on A such that B would fail if not built with the latest version of A
- You try to run the Clover plugin on B. The build would fail if we didn't pick the latest version between the original A version and the "clovered" A version.
We provide a 'fudge-factor' of 2 seconds, as the Clover artifact is created first.
Resolution
Use the <cloveredArtifactExpiryInMillis> configuration option for clover:instrument goal:
The difference (in milliseconds) that a -clover classified artifact can have to a non-clover classified artifact. If the -clover classified artifact is more than cloveredArtifactExpiryInMillis older than the non-clover classified artifact, then the non-classified artifact will be used. This setting defaults to 2000. Default value is: 2000
.