How to configure Clover license location in Maven and Jenkins

1.9k Views Asked by At

I know how to Clover in Maven (in local Eclipse or Jenkins), the problem is it's not a good idea to ask everyone put clover license in the same directory. Is there any suggestion for it?

    <properties>
        <clover.version>3.1.8</clover.version>
        <clover.license>C:\xxx\clover_license</clover.license>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-clover2-plugin</artifactId>
                <version>${clover.version}</version>
                <configuration>
                    <license>${clover.license}</license>
                </configuration>
            </plugin>
        </plugins>
    </build>

I think use Maven parameter to pass the variable is possible, but I need to set it in every project in Jenkins. And if I change the file in Jenkins server, I need to modify every project.

-Dclover.license=C:\xxx\clover_license
1

There are 1 best solutions below

0
On

See How to configure your clover.license for advice here. I recommend the suggestion to "Set up your .m2/settings.xml file", so you can define that property once:

<profiles>
    <profile>
      <id>my-clover-profile</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
         <!-- You can define the path to a license file: -->
         <maven.clover.licenseLocation>/path/to/clover.license</maven.clover.licenseLocation>

         <!-- Or you can embed license key (remember to keep newline characters): -->
         <maven.clover.license><![CDATA[
            ...
         ]]></maven.clover.license>
      </properties>
   </profile>
</profiles>