Why make donate
Ajouter une license non présente dans maven-license-plugin

Ajouter une license non présente dans maven-license-plugin

Vous pouvez souhaiter ajouter une nouvelle license qui n'est pas encore gérée par le plugin (les principales licenses libres sont gérées, mais dans le cas de logiciels privateurs (qu'ils soient open-source ou non), d'autres licenses peuvent être utilisées).

Créer les fichiers de license

  • src/licence/ma_licence/header.txt

    Le texte de license repris en haut de chaque fichier source.

    Exemple pour la license 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/ma_licence/license.txt

    Exemple pour la license 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>.
    
    

Déclarer la nouvelle license

La(les) nouvelle(s) license(s) doit être déclarée dans le fichier src/licence/licenses.properties. Une license par ligne :

    ma_licence=Ma license

Configurer le plugin

Vous devez spécifier la license et où la trouver.

<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>

ou

<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