java licensemavenplugin:updatefileheader如何排除项目名称?
我正在使用license maven插件成功地在源代码树中的每个文件中插入许可证标题。 它生成以下内容:
/*-
* #%L
* my-unqualified-package-name
* %%
* Copyright (C) 2009 - 2017 My Company. <info@mycompany.com>
* %%
* This software is the property of My Company. Etc. Etc.
*
* #L%
*/
我的pom
<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. <info@mycompany.com></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. <info@mycompany.com>
*
* ====================================================================
* This software is the property of My Company. Etc. Etc.
* ====================================================================
*/
# 1 楼答案
尝试切换到com.mycila:license-maven-plugin。他们的文档很容易理解
在文件中创建模板
例如,放入
license-header.txt
:配置插件
您可以使用
mvn license:format
格式化,或者只需将配置中的目标更改为format
即可在每次运行中进行格式化