Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
badgerwithagun opened this issue Jan 15, 2019 · 0 comments
Open

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

badgerwithagun opened this issue Jan 15, 2019 · 0 comments

Comments

@badgerwithagun
Copy link
Member

badgerwithagun commented Jan 15, 2019

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.

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

No branches or pull requests

1 participant