This project is a Maven plugin that inserts or removes a pre-configured copyright header into source code at build time. The plugin automatically resolves the necessary comment tag to surround the copyright for supported files. For unsupported arbitrary formats, the plugin can be configured to use a user-specified comment tag. The copyright is configured in an xml file called copyright-config.xml where the user can specify the file extension, body and, when applicable, the comment tags. The automatically supported file types include Java, XML, XHTML, and HTML. See the examples below for a custom configuration. Any file that the plugin touches will be backed up in a file called "copyright-plugin-backup" in the projects root, should a file need to be restored.
Build a jar from the source and add it to your local repository (any line wrapping for display only):
mvn install:install-file -Dfile=(Path to Jar File) -DgroupId=com.alexscottrhodes -DartifactId=copyright-maven-plugin -Dversion=1.0 -Dpackaging=jar
To configure a copyright, create a file called "copyright-config.xml" somewhere in your project's directory. Formatting will be maintained as it is typed in the configuration, including indentations.
To build your project and insert the copyright headers, use the Maven goal:
mvn copyright:cr
To remove the copyright, specify a removal:
mvn copyright:cr -Dremove=true;
Important! The removal feature matches the file's copyright header against the existing configuration. If you intend to remove the copyright, use the same configuration that was used to add it, or the removal will not work. Remove the copyright before changing the configuration. Similarly, duplicate copyright headers will NOT be added as long as the configuration file is the same. A backup of any file that receives the header is saved in a directory called copyright-plugin-backup in the project's root.
An example configuration and the resulting output is shown below: