如何在Maven和Jenkins中配置Clover许可证位置

时间:2013-08-07 14:38:40

标签: maven clover

我知道如何在Maven中使用Clover(在本地Eclipse或Jenkins中),问题是要求每个人都将三叶草许可证放在同一目录中并不是一个好主意。对此有什么建议吗?

    <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>

我认为使用Maven参数传递变量是可能的,但我需要在Jenkins的每个项目中设置它。如果我在Jenkins服务器中更改文件,我需要修改每个项目。

-Dclover.license=C:\xxx\clover_license

1 个答案:

答案 0 :(得分:2)

请在此处查看How to configure your clover.license的建议。我建议使用“设置.m2 / settings.xml文件”的建议,这样就可以定义该属性一次:

<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>
相关问题