Skip to main content

Source code browse

Revision: 63090

moving branch to tag
» Project Revision History

» Checkout URL

svn / tags / glassfish-copyright-maven-plugin-1.29

FilenameAuthorRevisionModifiedLog Entry
..
java_re 57293 over 2 years ago revert tags dir
java_re 57293 over 2 years ago revert tags dir
java_re 57293 over 2 years ago revert tags dir
		Copyright check/repair maven plugin

I've created a maven plugin to check for the proper copyright/license headers
and (in some cases) repair incorrect files.

Configure it as follows:

    <build>
	<plugins>
	    <plugin>
		<groupId>org.glassfish.build</groupId>
		<artifactId>glassfish-copyright-maven-plugin</artifactId>
	    </plugin>
	    <configuration>
	    	<excludeFile>copyright-exclude</excludeFile>
	    </configuration>
	    <dependencies>
	    	<dependency>
		    <groupId>org.glassfish.build</groupId>
		    <artifactId>glassfish-copyright-maven-plugin</artifactId>
		    <version>insert latest GlassFish version</version>
	    	</dependency>
	    </dependencies>
	</plugins>
    </build>

To check copyrights and report errors:

$ mvn glassfish-copyright:copyright

To only check copyrights, failing the build if there are any errors:

$ mvn glassfish-copyright:check

To repair any errors discovered (use this carefully, and check the results):

$ mvn glassfish-copyright:repair

You can add the following items in the <configuration> section:

	<excludeFile>file of exclude patterns</excludeFile>
	<exclude>
	    <pattern>an exclude pattern</pattern>
	</exclude>
	<scm>svn|mercurial|git</scm>	- defaults to svn
	<debug>true</debug>		- turn on debugging
	<update>false</update>		- for use with repair
	<warnings>false</warnings>	- turn off warnings
	<ignoreYear>true</ignoreYear>	- don't check that year is correct
	<scmOnly>true</scmOnly>		- skip files not under SCM
	<templateFile>file containg template</templateFile>


There are various errors that this plugin will correct:

- no copyright at all; these are the most likely cases for the plugin to
  do the wrong thing.
- a known, but incorrect, copyright.
- the correct copyright, but the copyright year wasn't updated.

Note that the repair option doesn't know what the copyright for a
file *should* be.  If the only thing wrong is the date, it just fixes
it.  But if the header is wrong it assumes the file should have the
CDDL+GPL copyright, and replaces any existing copyright with that.
If the file has a BSD license, it relaces it with the standard BSD
license.  If the file has "supplemental" license text in our standard
format (e.g., an Apache or MIT license), it tries to preserve that.
However, if the file is *intended* to have one of the Apache-derived
copyright/license headers or the BSD license (for example), but
doesn't, or it isn't in the expected format, the wrong license will
be applied.

If you have files that should be excluded from the checks (e.g.,
because they purposely have a different license), you can use the
<exclude> option to list them.  You can repeat the <pattern> as many times
as you need it, or you can put the names in the file and specify the
file name to the <excludeFile> option.
The excluded names are *substrings* (not regular expressions) that
are matched against the path/file name.

Good entries for an exclude list are:

/MANIFEST.MF
/META-INF/services/
/README
.gif
.jpg
.png
.exe
.ico
.jar
.zip
.war
.sql
.jks
.json
.class
 
 
Close
loading
Please Confirm
Close