|
|
Introduction
maven-license-plugin is a Maven 2 plugin that help you managing license headers in source files.
Basically, when you are developing a project either in open source or in a company, you often need to add at the top of your source files a license to protect your work.
I didn't find any maven plugin on Internet to help you maintain these license headers. By maintaining, i mean checking if the header is here or not, generating a report and of course having the possibility to update / reformat missing license headers.
I only found RAT Maven plugin but this plugin only does a check.
Features
- Check: check if header is missing in some source file
- Reformat: add headers if missing
- Remove: ca nremove existing header
- Custom mappings: enables easy support of new file extensions
- Variable replacement: You can add some variable in your header, such as ${year}, ${owner} and they will be replaced by the corresponding values taken from the pom or system properties.
Be up to date !
For the most recent version, see the Release Notes.
You can also subscribe to the google group mailing lists or RSS feeds to get the latest announcements, issues updates, svn updates, ... See the mailing lists section.
How to use and configure the plugin
The usage of the plugin is very simple. It is described in detail in the How To page.
To configure the plugin, see the configuration reference guide.
You can also have a check on the maven website of this plugin at http://mathieu.carbou.free.fr/p/maven-license-plugin/plugin-info.html
Supported comments
The plugin has been designed so that it is very easy to add new supports for new sorts of comment.
The plugin currently support these types of comment:
- java (Java-like comments)
/** * My comment */
- xml (XML-like comments)
<!--
My comment
-->- apt (APT-like comments)
~~ My comment
- properties (Property file comments)
# My comment
- batch (Windows batch comments)
@REM My comment
- text (Text like comments)
====
My comment
====(4 spaces, then the lines of the header)
- sql (Sql like comments)
-- -- test comment --
- jsp (JSP like comments)
<%--
comment
--%>- ftl (FreeMarker like comments)
<#--
comment
-->- ftl_alt (FreeMarker Alternative Syntax comments)
[#ftl ...]
[#--
comment
--]- vm (Velocity templates comments)
#*
comment
*##Supported file extensions
From the different supported comment types, we can add any mapping we want. By default, the plugin includes the mappings below between the extension of the file and the comment type above:
| File extension | Comment type |
| java | java |
| groovy | java |
| js | java |
| css | java |
| xml | xml |
| dtd | xml |
| xsd | xml |
| fml | xml |
| xsl | xml |
| html | xml |
| htm | xml |
| apt | apt |
| properties | properties |
| sh | properties |
| txt | text |
| bat | batch |
| cmd | batch |
| sql | sql |
| jsp | jsp |
| ftl | ftl |
| ftl | ftl_alt |
| xhtml | xml |
| vm | velocity |
The plugin enables you to add any other mapping you want. I.e., if you are developing a Tapestry web application, you may need to add license header in .jwc files and .application files. since these files are xml files, you only need to add in your project pom the following mapping for the maven-license-plugin:
<mapping>
<jwc>xml</jwc>
<application>xml</application>
</mapping>variable replacement in header
You can define some variable in your header, and they will be replaced when the header file will be read. The values of the properties are taken first from the command line (java system properties), then from the plugin properties, then from the system properties.
See the configuration reference guide to see how to use it.
Getting help
- Maven 2 project website, with plugin description: http://mathieu.carbou.free.fr/p/maven-license-plugin/plugin-info.html
- My website: http://mathieu.carbou.free.fr/
- Issue tab of this project
- Email...
