Why make donate
Add a license not present in maven-license-plugin

Add a license not present in maven-license-plugin

You might want to add a new license that is not already managed by the plugin (common free software licenses are managed, but in case of proprietary software (open or closed source, other license might be used).

Create the license files

  • src/licence/my_licence/header.txt

    Example for GPLv3 :

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public
    License along with this program.  If not, see
    <http://www.gnu.org/licenses/gpl-3.0.html>.
    
  • src/licence/my_licence/license.txt

    Example for GPLv3 :

                        GNU GENERAL PUBLIC LICENSE
                           Version 3, 29 June 2007
    
     Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.
    
                                Preamble
    
      The GNU General Public License is a free, copyleft license for
    software and other kinds of works.
    
    ...
    
      The GNU General Public License does not permit incorporating your program
    into proprietary programs.  If your program is a subroutine library, you
    may consider it more useful to permit linking proprietary applications with
    the library.  If this is what you want to do, use the GNU Lesser General
    Public License instead of this License.  But first, please read
    <http://www.gnu.org/philosophy/why-not-lgpl.html>.
    
    

Declare the new license

The new license(s) must be declared in the file : src/licence/licenses.properties. One license per line like :

    my_licence=My license
    

Configure the plugin

You need to specify the name of your license and where to find it.

<plugin>
    <groupId>org.nuiton</groupId>
    <artifactId>maven-license-plugin</artifactId>
    <configuration>
        <licenseName>my_licence</licenseName>
        <licenseResolver>file://${basedir}/src/license</licenseResolver>
    </configuration>
    <executions>
        <execution>
            <id>first</id>
            <goals>
                <goal>update-file-header</goal>
            </goals>
            <phase>process-sources</phase>
        </execution>
    </executions>
</plugin>

or

<properties>
    <license.licenseName>my_licence</license.licenseName>
    <license.licenseResolver>file://${basedir}/src/license</license.licenseResolver>
</properties>

<plugin>
    <groupId>org.nuiton</groupId>
    <artifactId>maven-license-plugin</artifactId>
    <executions>
        <execution>
            <id>first</id>
            <goals>
                <goal>update-file-header</goal>
            </goals>
            <phase>process-sources</phase>
        </execution>
    </executions>
</plugin>
Maven JRst ReStructuredText