2017-10-31 7 views
0

私はlicense-maven-pluginを使用してソースツリーの各ファイルにライセンスヘッダーを挿入しています。 これは、生成し、次のlicense-maven-plugin:update-file-headerプロジェクト名を除外する方法は?

/*- 
* #%L 
* my-unqualified-package-name 
* %% 
* Copyright (C) 2009 - 2017 My Company. <[email protected]> 
* %% 
* This software is the property of My Company. Etc. Etc. 
* 
* #L% 
*/ 

私のポンポン、

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>license-maven-plugin</artifactId> 
      <version>1.14</version> 
      <configuration> 
       <inceptionYear>2009</inceptionYear> 
       <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage> 
       <organizationName>My Company. &lt;[email protected]&gt;</organizationName> 
       <licenseName>my_license</licenseName> 
       <licenseResolver>${project.baseUri}/src/license</licenseResolver> 
       <roots> 
        <!-- <root>src/main/java</root> --> 
        <root>src/test</root> 
       </roots> 
      </configuration> 
      <executions> 
       <execution> 
        <id>first</id> 
        <goals> 
         <goal>update-file-header</goal> 
        </goals> 
        <phase>process-sources</phase> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

しかし、私は次の形式をしたい、

/** 
* Copyright (C) 2009 - 2018 My Company. <[email protected]> 
* 
* ==================================================================== 
* This software is the property of My Company. Etc. Etc. 
* ==================================================================== 
*/ 

答えて

2

このlicense-maven-pluginに切り替えてみてください。彼らの文書は非常に簡単です。

license-header.txtに入れて、例えばファイルに

をテンプレートを作成します。

Copyright (C) ${license.years} ${license.owner} <${license.email}> 

==================================================================== 
This software is the property of ${license.owner}. Etc. Etc. 
==================================================================== 

あなたはmvn license:formatか、単に変化に書式設定することができ、プラグインに

<plugin> 
    <groupId>com.mycila</groupId> 
    <artifactId>license-maven-plugin</artifactId> 
    <configuration> 
    <header>license-header.txt</header> 
    <properties> 
     <license.owner>My Company</license.owner> 
     <license.years>2009 - 2018</license.years> 
     <license.email>[email protected]</license.email> 
    </properties> 
    <includes> 
     <include>src/*/java/**/*.java</include> 
    </includes> 
    </configuration> 
    <executions> 
    <execution> 
     <id>first</id> 
     <goals> 
     <goal>check</goal> 
     </goals> 
     <phase>process-sources</phase> 
    </execution> 
    </executions> 
</plugin> 

を設定設定の目標はすべての実行でそれを行うには。

+0

それは私のために働く.. :) – SST

関連する問題