java - How to use the the license-maven-plugin -
i use license-maven-plugin
in order able generate license headers project.
so have following pom.xml:
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.foo</groupid> <artifactid>bar-parent</artifactid> <version>1.0-snapshot</version> <packaging>pom</packaging> <name>bar: parent</name> <licenses> <license> <name>apache 2.0</name> <url>http://www.apache.org/licenses/license-2.0.txt</url> <distribution>repo</distribution> <comments>a business-friendly oss license</comments> </license> </licenses> <organization> <name>my corp.</name> <url>http://www.mycorp.org/</url> </organization> <inceptionyear>2014</inceptionyear> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <license.licensename>apache_v2</license.licensename> </properties> <build> <pluginmanagement> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>license-maven-plugin</artifactid> <version>1.6</version> <configuration> <verbose>false</verbose> <includes> <includes>**/*.java</includes> </includes> </configuration> <executions> <execution> <id>generate-license-headers</id> <goals> <goal>update-file-header</goal> </goals> <phase>process-sources</phase> <configuration> <licensename>apache 2.0</licensename> <roots> <root>src/main/java</root> <root>src/test/java</root> </roots> </configuration> </execution> </executions> </plugin> </plugins> </pluginmanagement> </build> ... </project>
i'm invoking following command-line:
mvn license:update-file-header
this passes, license header ends looking this:
/* * #%l * bar: foo * %% * copyright (c) 2014 corp. * %% * licensed under apache license, version 2.0 (the "license"); * may not use file except in compliance license. * may obtain copy of license @ * * http://www.apache.org/licenses/license-2.0 * * unless required applicable law or agreed in writing, software * distributed under license distributed on "as is" basis, * without warranties or conditions of kind, either express or implied. * see license specific language governing permissions , * limitations under license. * #l% */
obviously, don't want #%l
, %%
, #l%
in license header. need set in order rid of those?
the documentation version 1.9 (latest @ time of writing) says these mandatory delimiters find header.
(1) # % l (2) project description (3) %% (4) copyright (c) 2010 organization (5) %% (6) license content (7) # l %
- the start process tag used detect begin of header (never suppress it).
- project description section
- header section delimiter
- copyright section of file (see next section detail)
- header section delimiter
- license section
- the end process tag used detect end of header (never suppress it).
Comments
Post a Comment