[BUILD-110] Add a way to completely skip Clover Created: 28/Jun/12  Updated: 13/Apr/17  Resolved: 28/Jun/12

Status: Closed
Project: Build
Component/s: Poms
Affects Version/s: None
Fix Version/s: POMs 24

Type: New Feature Priority: Critical
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File CLV-5796 - Maven plugin can't seem to be able to completely skip Clover execution.webarchive    
Issue Links:
causality
is causing BUILD-124 Skipping Clover on releases does not ... Closed
supersession
supersedes BUILD-90 Separate parent poms for builds using... Closed
supersedes BUILD-58 site-deploy on ce && ee bundle does n... Closed
Template:
Acceptance criteria:
Empty

 Description   

Following BUILD-58 and BUILD-90, I (with the help of Atlassian folks, Google, and various colleagues, obviously) came to the conclusion that:

  • Clover can't be entirely skipped using the <skip> configuration item; a lifecycle will always be forked, as soon as a Clover goal is registered in the build. See CLV-5796.
  • So we need to push all Clover configuration into a profile to be able to isolate it.
  • Profiles can only be activated by the presence of a file, system property (not pom property!), or manually (via the -P flag). (or depending on JDK or OS, but this is irrelevant here)
  • The activation of a profile (i.e what file is used as the "trigger" for example) can not rely on pom properties either. (I tried doing <activation><file><exists>${fileToTriggerClover}, then have a pom property with a value of pom.xml - it would thus have been easy to change the value of that property to some non-existant file in projects where we want to skip Clover entirely. Does not work. Maven 3 seems to allow some properties to be used, like basedir, but that's about it.

Consequently, here's what I'm seeing as a practical solution:

  • Declare a profile that enables Clover.
  • On local dev builds, activate the profile manually (with -P).
  • On build servers, the profile can be activated by a well known property provided by the build server, such as BUILD_NUMBER on Hudson.
  • Configure the release plugin to activate this profile during releases. In fact, we already do this, and activate the existing release-perform-profile profile, which enforces usage of Maven 2.2.1. We can move this to a pom property, thus letting each project configure their releaseProfiles list: release-perform-profile,enable-clover will be the default.


 Comments   
Comment by Magnolia International [ 28/Jun/12 ]

Done.
The new profile is called enable-clover. It is enabled by default on Hudson via a system property, and during release:perform by configuration of the release plugin.

By default, any other build will not go through Clover.

  • To enable it "manually" when building on your machine, use the -P enable-clover flag.
  • To skip Clover on Hudson, pass -P !enable-clover to disable the profile.
  • To skip Clover entirely on projects such as the bundles, re-define the additionalReleaseProfiles property in the pom, for example:
    <properties>
      <!-- Disable clover during releases: -->
      <additionalReleaseProfiles />
    </properties>
    

    <additionalReleaseProfiles>none</additionalReleaseProfiles> also works, but Maven then tries to actually activate a profile called none, which doesn't exist, thus yielding a warning.
    AFAICT, you can even do this in a specific module of a multi-module project; for example STK's 'bundle' module could be a candidate.
    This property is used to determine what profiles are used on top of release-perform-profile during the release:perform phase. It's default value is enable-clover (the name of the new profile).

Caveat !

This doesn't work for submodules of a reactor build ! See BUILD-124.

Generated at Sun Feb 11 23:38:51 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.