Maven 2 License Plugin: Easily Manage License Headers
All this required work is quite time expensive and a developer doesn't need to spend his or her time managing headers on source files.
Searching on the Internet, I found only these tools relative to license header:
- Release Audit Tool: http://code.google.com/p/arat/
- The Maven 2 plugin for RAT: http://mojo.codehaus.org/rat-maven-plugin/
- Chechstyle
- Another one (which I do not remember the name) that is just a command-line tool.
But these tools lack features. Using Maven intensively as a project
management tool, I wanted to have a Maven 2 plugin capable of checking
in the verify phase if the license headers are here, and of course with
the ability to add or update these headers.
Therefore I wrote a Maven 2 license plugin available at
http://code.google.com/p/maven-license-plugin/
that anyone can use in his or her POM like this:
<build>
<plugins>
<plugin>
<groupId>com.mathieucarbou.mojo</groupId>
<artifactId>maven-license-plugin</artifactId>
<configuration>
<headerFile>src/main/etc/header.txt</headerFile>
</configuration>
</plugin>
</plugins>
</build>
There are several other way of using it and a lot of configuration
options all documented on the Google project website.
To invoke the plugin, simply issue:
mvn license:check
mvn license:format
These are the two goals available, the first one to check if header are present and the other one to reformat source files.
- Login or register to post comments
- 2436 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)









