What's new? | Help | Directory | Sign in
Google
maven-license-plugin
Maven plugin to update header licenses of source files
  
  
  
  
    
Code License: Apache License 2.0
Labels: maven, license, plugin, header, source, file
Join project
Project owners:
  mathieu.carbou

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

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:

/**
 * My comment
 */
<!--
    My comment
-->
~~ My comment
# My comment
@REM My comment
====
    My comment
====

(4 spaces, then the lines of the header)

--
-- test comment
--
<%--
    comment
--%>
<#--
    comment
-->
[#ftl ...]
[#--
    comment
--]
#*
    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