When I build my project issuing a cleanup first, I see messages saying the following:
[WARNING] Using [com.vmware....1.0-SNAPSHOT], built on Thu Oct 23 04:09:12 PDT 2014 even though a Clovered version exists but it's older (lastModified: Fri Oct 10 00:21:13 PDT 2014 ) and could fail the build. Please consider running Clover again on that dependency's project.
I checked the local repository and found the JAR that the message points to.
Should I delete older versions of the instrumented JARs from my local ".m2/repository" directory before the next instrumentation and the build of the app is initiated?
If I don't delete older JARs from the local repo, does it mean that no instrumentation and build will be initiated on those JARS that have already once been installed to the local repo?
There is no need to delete older versions of instrumented JARs. Deleting any *-clover.jar files will actually not change anything (just the above warning will disappear). You shall rather rebuild that dependent module with Clover.
The error message "Using ... even though a Clovered version exists" means the following:
Let's say you have a project containing of two modules: 'rocket' and 'engine' and that the 'rocket' module has a dependency to the 'engine' module. Let's say you will call clover2:instrument on the 'engine' module - Maven will install the engine-<version>-clover.jar artifact in your ~/.m2 cache. Now, let's say that you will run another build and run the 'clover2:instrument' on the 'rocket' module.
Which engine*.jar Clover shall take? The original one (engine-<version>.jar) or the instrumented one (engine-<version>-clover.jar)? Clover has a policy that it will take the newer JAR (unless time stamps do not vary too much - see https://docs.atlassian.com/maven-clover2-plugin/latest/setup-mojo.html#cloveredArtifactExpiryInMillis option). Even if it means that the non-instrumented JAR would be picked up (and thus there would be no code coverage recorded for that dependent module). Why? Because, otherwise, the outdated, but instrumented JAR could fail a build (for instance, an API could have been changed in that dependent module).
Thanks for the answer Marek.
In regards to my question, would like to double check one more thing.
I used to build my web application using the following command:
mvn com.atlassian.maven.plugins:maven-clover2-plugin:3.3.0:setup install -DskipTests=true Dmaven.clover.cloverDatabase=<path_to_database> -Dmaven.clover.licenseLocation=<license_location>
When the above mentioned command is executed, I normally get ~273 warnings about older clovered artifacts.
I changed the script and now I build the app usin:
mvn com.atlassian.maven.plugins:maven-clover2-plugin:3.3.0:instrument ...
Now I am getting ~73 warnings.
Did the change instrument and use more instrumented artifacts?
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs