Skip to content

Wire license-maven-plugin + commit into release builds #77

Description

@badgerwithagun

Our licence mastheads have a tendency to go missing or out of date. I've had a lot of success with (one of the) Maven plugins for this purpose:

        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>3.0</version>
          <configuration>
            <header>etc/HEADER</header>
            <includes>
              <include>**/*.java</include>
              <include>**/*.js</include>
              <include>src</include>
            </includes>
            <excludes>
              <exclude>src/test/resources/**</exclude>
              <exclude>src/main/resources/**</exclude>
            </excludes>
          </configuration>
        </plugin>

I like the simplicity of this one - it just inserts the content of a defined HEADER file at the top of every file in a language-appropriate way (it handles the correct commenting style for the file type).

Example of a HEADER file:

Spline Reticulator
Copyright © 2018-2019 Horace

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

The only complication is where to wire it in. What I do is to run it using a "release" profile in a format-only build, then commit+push, then run the main build, as three separate steps in a release pipeline. This means it only kicks in when a release is performed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions