mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
12.28.2016 9fc50bc635f877eb95e1f29b95c92f1e40116450
Improve copyright maven plugin

Creates a property name to allow user to set the reference git branch to
use in the diff command.
Also log a quick message to explain how to use the property.
Extracs some constants to mutualize the code.
2 files modified
10 ■■■■ changed files
opendj-sdk/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java 7 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java 3 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java
@@ -38,12 +38,13 @@
 */
@Mojo(name = "check-copyright", defaultPhase = LifecyclePhase.VALIDATE)
public class CheckCopyrightMojo extends CopyrightAbstractMojo {
    private static final String IGNORE_COPYRIGHT_ERRORS_PROPERTY = "ignoreCopyrightErrors";
    /**
     * The property that may be used to prevent copyright date problems from
     * failing the build.
     */
    @Parameter(required = true, property = "ignoreCopyrightErrors", defaultValue = "false")
    @Parameter(required = true, property = IGNORE_COPYRIGHT_ERRORS_PROPERTY, defaultValue = "false")
    private boolean ignoreCopyrightErrors;
    @Parameter(required = true, property = "skipCopyrightCheck", defaultValue = "false")
@@ -74,9 +75,11 @@
            if (!ignoreCopyrightErrors) {
                getLog().warn("Fix copyright date problems before proceeding, "
                                + "or use '-DignoreCopyrightErrors=true' to ignore copyright errors.");
                        + "or use '-D" + IGNORE_COPYRIGHT_ERRORS_PROPERTY + "=true' to ignore copyright errors.");
                getLog().warn("You can use update-copyrights maven profile "
                        + "(mvn validate -Pupdate-copyrights) to automatically update copyrights.");
                getLog().warn("Use '-D" + DIFF_REFERENCE_BRANCH_NAME_PROPERTY + "=branchname' to change the reference "
                        + "branch which is used against your active local branch to check committed changes.");
                throw new MojoExecutionException("Found files with potential copyright year updates needed");
            }
        } else {
opendj-sdk/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java
@@ -69,6 +69,7 @@
 * Abstract class which is used for both copyright checks and updates.
 */
public abstract class CopyrightAbstractMojo extends AbstractMojo {
    static final String DIFF_REFERENCE_BRANCH_NAME_PROPERTY = "checkCopyrightDiffReferenceBranchName";
    /** The Maven Project. */
    @Parameter(required = true, property = "project", readonly = true)
@@ -89,7 +90,7 @@
    private String scmRepositoryUrl;
    /** The Git master branch name of the repository. **/
    @Parameter(required = true, defaultValue = "origin/master")
    @Parameter(required = true, property = DIFF_REFERENCE_BRANCH_NAME_PROPERTY, defaultValue = "origin/master")
    private String gitMasterBranchName;
    /**