License Management via Maven Plugin

Keeping a license current is luckily addressed by the mycila license maven plugin. This plugin scans the project files in src files and updates the files with the license.txt format. To configure the plguin refer to

To check the current status of the copyrights and see what needs to be updated: mvn com.mycila:license-maven-plugin:check -f my-parent/pom.xml

To format the current missing copyrights and update: mvn com.mycila:license-maven-plugin:format -f my-parent/pom.xml

Results are:
[INFO] ————————————————————————
[INFO] Building my-project 99-SNAPSHOT
[INFO] ————————————————————————
[INFO] — license-maven-plugin:3.0:format (default-cli) @ my-project —
[INFO] Updating license headers…
[WARNING] Unknown file extension: /Users/paulbastide/git/wffh/my/my-project/.factorypath
[INFO] Updating license header in: /Users/paulbastide/git/wffh/my/my-project/src/main/webapp/WEB-INF/ibm-web-ext.xml
[WARNING] Unable to find a comment style definition for some files. You may want to add a custom mapping for the relevant file extensions.
Once you run the copyright format, you’ll see the change in the files.

Plugin for your pom.xml
The plugin snippet as follows and that goes in <build><plugins></plugins></build>:

To run the mojo independently use:
mvn com.mycila:license-maven-plugin:check -f my-project/pom.xml -Dlicense.header=./license.txt -license.skipExistingHeaders=true

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.