mavenmaven-pluginclover

Switch to turn on/off Atlassian Clover in Maven


I am using Clover via Maven during every build. The majority of the time the code coverage does not change much so I now do not want to have it run every time. Clover slows down the compilation a lot. Is there a maven switch that allows me to not run clover? It is run as a plugin so an alternative question is whether it is possible in Maven to disable some plugins with certain switches.

FYI the clover website is here for those of you who do not use it. http://www.atlassian.com/software/clover/overview


Solution

  • You should be able to accomplish this with profile activation and a custom property.

    If you surround your clover plugin with a profile and use profile activation, you can define the property on the command line when you want to run it.

    <profiles>
      <profile>
        <activation>
          <property>
            <name>clover</name>
          </property>
        </activation>
        ...
      </profile>
    </profiles>
    

    Then, when calling maven, use -Dclover on the command line to activate the clover steps. If you don't provide the -Dclover then clover will not run.