From ac4a54801838c7529387fe1e73c2e5c4a8872d1a Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 17 Feb 2015 10:33:31 +0000
Subject: [PATCH] OPENDJ-1769 Add a copyright check-update maven plugin
---
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt | 19
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt | 25
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt | 25
pom.xml | 23
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-6.txt | 20
opendj-copyright-maven-plugin/src/test/java/org/forgerock/maven/UpdateCopyrightTestCase.java | 182 +++++++
opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java | 283 ++++++++++
opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/package-info.java | 29 +
opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java | 424 ++++++++++++++++
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt | 26 +
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt | 18
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt | 27 +
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt | 26 +
opendj-copyright-maven-plugin/pom.xml | 103 +++
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-5.txt | 18
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-1.txt | 28 +
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt | 28 +
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-4.txt | 17
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt | 27 +
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt | 26 +
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt | 16
opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java | 85 +++
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt | 27 +
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt | 24
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt | 29 +
25 files changed, 1,555 insertions(+), 0 deletions(-)
diff --git a/opendj-copyright-maven-plugin/pom.xml b/opendj-copyright-maven-plugin/pom.xml
new file mode 100644
index 0000000..739d41c
--- /dev/null
+++ b/opendj-copyright-maven-plugin/pom.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>opendj-project</artifactId>
+ <groupId>org.forgerock.opendj</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>opendj-copyright-maven-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>OpenDJ Copyright Check Maven Plugin</name>
+ <description>
+ Checks ForgeRock source file copyrights.
+ </description>
+ <packaging>maven-plugin</packaging>
+
+ <properties>
+ <forgerockBuildToolsVersion>1.0.2</forgerockBuildToolsVersion>
+ <mavenVersion>3.2.3</mavenVersion>
+ <plexusUtilsVersion>3.0.17</plexusUtilsVersion>
+ <mavenPluginPluginVersion>3.2</mavenPluginPluginVersion>
+ </properties>
+
+ <dependencies>
+ <!-- Maven -->
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${mavenVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${mavenPluginPluginVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Testing -->
+ <dependency>
+ <groupId>org.forgerock</groupId>
+ <artifactId>forgerock-build-tools</artifactId>
+ <version>${forgerockBuildToolsVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Other -->
+
+ <dependency>
+ <groupId>org.twdata.maven</groupId>
+ <artifactId>mojo-executor</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+
+ <!-- Runtime -->
+ <dependency>
+ <groupId>org.forgerock.commons</groupId>
+ <artifactId>forgerock-util</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-api</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-provider-svn-commons</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-provider-svnexe</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-provider-gitexe</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java
new file mode 100644
index 0000000..9f2f447
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2015 ForgeRock AS.
+ */
+package org.forgerock.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+/**
+ * This be used to check that if a modified file contains a line that appears to
+ * be a comment and includes the word "copyright", then it should contain the
+ * current year.
+ */
+@Mojo(name = "check-copyright", defaultPhase = LifecyclePhase.VALIDATE)
+public class CheckCopyrightMojo extends CopyrightAbstractMojo {
+
+ /**
+ * The property that may be used to prevent copyright date problems from
+ * failing the build.
+ */
+ @Parameter(required = true, property = "ignoreCopyrightErrors", defaultValue = "false")
+ private boolean ignoreCopyrightErrors;
+
+ @Parameter(required = true, property = "skipCoyprightCheck", defaultValue = "false")
+ private boolean checkDisabled;
+
+ /**
+ * Uses maven-scm API to identify all modified files in the current
+ * workspace. For all source files, check if the copyright is up to date.
+ *
+ * @throws MojoFailureException
+ * if any
+ * @throws MojoExecutionException
+ * if any
+ */
+ public void execute() throws MojoFailureException, MojoExecutionException {
+ if (checkDisabled) {
+ getLog().info("Copyright check is disabled");
+ return;
+ }
+
+ checkCopyrights();
+ if (!getIncorrectCopyrightFilePaths().isEmpty()) {
+ getLog().warn("Potential copyright year updates needed for the following files:");
+ for (String filename : getIncorrectCopyrightFilePaths()) {
+ getLog().warn(" " + filename);
+ }
+
+ if (!ignoreCopyrightErrors) {
+ getLog().warn("Fix copyright date problems before proceeding, "
+ + "or use '-DignoreCopyrightErrors=true' to ignore copyright errors.");
+ getLog().warn("You can use 'mvn org.forgerock.opendj:opendj-copyright-maven-plugin:update-copyright' "
+ + "command to automatically update copyrights.");
+ throw new MojoExecutionException("Found files with potential copyright year updates needed");
+ }
+ } else {
+ getLog().info("Copyrights are up to date");
+ }
+ }
+}
diff --git a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java
new file mode 100644
index 0000000..3d77e58
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java
@@ -0,0 +1,283 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2015 ForgeRock AS.
+ */
+package org.forgerock.maven;
+
+import static org.forgerock.util.Utils.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.scm.ScmException;
+import org.apache.maven.scm.ScmFile;
+import org.apache.maven.scm.ScmFileSet;
+import org.apache.maven.scm.command.status.StatusScmResult;
+import org.apache.maven.scm.manager.BasicScmManager;
+import org.apache.maven.scm.manager.NoSuchScmProviderException;
+import org.apache.maven.scm.manager.ScmManager;
+import org.apache.maven.scm.provider.ScmProvider;
+import org.apache.maven.scm.provider.git.gitexe.GitExeScmProvider;
+import org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider;
+import org.apache.maven.scm.repository.ScmRepository;
+import org.apache.maven.scm.repository.ScmRepositoryException;
+
+/**
+ * Abstract class which is used for both copyright checks and updates.
+ */
+public abstract class CopyrightAbstractMojo extends AbstractMojo {
+
+ /** The Maven Project. */
+ @Parameter(required = true, property = "project", readonly = true)
+ private MavenProject project;
+
+ /**
+ * Copyright owner.
+ * This string token must be present on the same line with 'copyright' keyword and the current year.
+ */
+ @Parameter(required = true, defaultValue = "ForgeRock AS")
+ private String copyrightOwnerToken;
+
+ /** The path to the root of the Subversion workspace to check. */
+ @Parameter(required = true, defaultValue = "${basedir}")
+ private String scmWorkspaceRoot;
+
+ @Parameter(required = true, defaultValue = "${project.scm.connection}")
+ private String scmRepositoryUrl;
+
+ /** The file extensions to test. */
+ public static final List<String> CHECKED_EXTENSIONS = new LinkedList<String>(Arrays.asList(
+ "bat", "c", "h", "html", "java", "ldif", "Makefile", "mc", "sh", "txt", "xml", "xsd", "xsl"));
+
+ private static final List<String> EXCLUDED_END_COMMENT_BLOCK_TOKEN = new LinkedList<String>(Arrays.asList(
+ "*/", "-->"));
+
+ private static final List<String> SUPPORTED_COMMENT_MIDDLE_BLOCK_TOKEN = new LinkedList<String>(Arrays.asList(
+ "*", "#", "rem", "!"));
+
+ private static final List<String> SUPPORTED_START_BLOCK_COMMENT_TOKEN = new LinkedList<String>(Arrays.asList(
+ "/*", "<!--"));
+
+ /** The string representation of the current year. */
+ Integer currentYear = Calendar.getInstance().get(Calendar.YEAR);
+
+ private final List<String> incorrectCopyrightFilePaths = new LinkedList<String>();
+
+ /** The overall SCM Client Manager. */
+ private ScmManager scmManager;
+
+ private ScmRepository scmRepository;
+
+ List<String> getIncorrectCopyrightFilePaths() {
+ return incorrectCopyrightFilePaths;
+ }
+
+ private ScmManager getScmManager() throws MojoExecutionException {
+ if (scmManager == null) {
+ scmManager = new BasicScmManager();
+ String scmProviderID = getScmProviderID();
+ ScmProvider scmProvider;
+ if ("svn".equals(scmProviderID)) {
+ scmProvider = new SvnExeScmProvider();
+ } else if ("git".equals(scmProviderID)) {
+ scmProvider = new GitExeScmProvider();
+ } else {
+ throw new MojoExecutionException("Unsupported scm provider: " + scmProviderID + " or "
+ + getIncorrectScmRepositoryUrlMsg());
+ }
+ scmManager.setScmProvider(scmProviderID, scmProvider);
+ }
+
+ return scmManager;
+ }
+
+ private String getScmProviderID() throws MojoExecutionException {
+ try {
+ return scmRepositoryUrl.split(":")[1];
+ } catch (Exception e) {
+ throw new MojoExecutionException(getIncorrectScmRepositoryUrlMsg(), e);
+ }
+ }
+
+ String getIncorrectScmRepositoryUrlMsg() {
+ return "the scmRepositoryUrl property with value '" + scmRepositoryUrl + "' is incorrect. "
+ + "The URL has to respect the format: scm:[provider]:[provider_specific_url]";
+ }
+
+ ScmRepository getScmRepository() throws MojoExecutionException {
+ if (scmRepository == null) {
+ try {
+ scmRepository = getScmManager().makeScmRepository(scmRepositoryUrl);
+ } catch (NoSuchScmProviderException e) {
+ throw new MojoExecutionException("Could not find a provider.", e);
+ } catch (ScmRepositoryException e) {
+ throw new MojoExecutionException("Error while connecting to the repository", e);
+ }
+ }
+
+ return scmRepository;
+ }
+
+ String getScmWorkspaceRoot() {
+ return scmWorkspaceRoot;
+ }
+
+ /** Performs a diff with current working directory state against remote HEAD revision. */
+ List<String> getChangedFiles() throws MojoExecutionException, MojoFailureException {
+ try {
+ ScmFileSet workspaceFileSet = new ScmFileSet(new File(getScmWorkspaceRoot()));
+ StatusScmResult statusResult = getScmManager().status(getScmRepository(), workspaceFileSet);
+ if (!statusResult.isSuccess()) {
+ getLog().error("Impossible to perform scm status command because " + statusResult.getCommandOutput());
+ throw new MojoFailureException("SCM error");
+ }
+
+ List<ScmFile> scmFiles = statusResult.getChangedFiles();
+ List<String> changedFilePaths = new LinkedList<String>();
+ for (ScmFile scmFile : scmFiles) {
+ changedFilePaths.add(scmFile.getPath());
+ }
+
+ return changedFilePaths;
+ } catch (ScmException e) {
+ throw new MojoExecutionException("Encountered an error while examining modified files, SCM status: "
+ + e.getMessage() + "No further checks will be performed.", e);
+ }
+ }
+
+ /** Examines the provided files list to determine whether each changed file copyright is acceptable. */
+ void checkCopyrights() throws MojoExecutionException, MojoFailureException {
+ for (String changedFileName : getChangedFiles()) {
+ File changedFile = new File(getScmWorkspaceRoot(), changedFileName);
+ if (!changedFile.exists() || !changedFile.isFile()) {
+ continue;
+ }
+
+ int lastPeriodPos = changedFileName.lastIndexOf('.');
+ if (lastPeriodPos > 0) {
+ String extension = changedFileName.substring(lastPeriodPos + 1);
+ if (!CHECKED_EXTENSIONS.contains(extension.toLowerCase())) {
+ continue;
+ }
+ } else {
+ // We'll still want to check it if it's in a resource/bin directory.
+ if (fileNameEquals("bin", changedFile.getParentFile())
+ && fileNameEquals("resource", changedFile.getParentFile().getParentFile())) {
+ continue;
+ }
+ }
+
+ if (!checkCopyrightForFile(changedFile)) {
+ incorrectCopyrightFilePaths.add(changedFile.getAbsolutePath());
+ }
+ }
+ }
+
+ private boolean fileNameEquals(String folderName, File file) {
+ return file != null && folderName.equals(file.getName());
+ }
+
+ /**
+ * Check to see whether the provided file has a comment line containing a
+ * copyright without the current year.
+ */
+ @SuppressWarnings("resource")
+ private boolean checkCopyrightForFile(File changedFile) throws MojoExecutionException {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new FileReader(changedFile));
+ String line = reader.readLine();
+
+ while (line != null) {
+ String lowerLine = line.toLowerCase().trim();
+ if (isCommentLine(lowerLine)) {
+ int copyrightPos = lowerLine.indexOf("copyright");
+ if (copyrightPos > 0) {
+ if (line.contains(currentYear.toString()) && line.contains(copyrightOwnerToken)) {
+ reader.close();
+ return true;
+ }
+ }
+ }
+ line = reader.readLine();
+ }
+
+ return false;
+ } catch (IOException ioe) {
+ StringBuilder errorMsg = new StringBuilder().append(" Could not read file ")
+ .append(changedFile.getPath())
+ .append(" to check copyright date. No further copyright date checking will be performed.");
+ throw new MojoExecutionException(errorMsg.toString());
+ } finally {
+ closeSilently(reader);
+ }
+ }
+
+ private String getCommentToken(String line, boolean includesStartBlock) {
+ List<String> supportedTokens = SUPPORTED_COMMENT_MIDDLE_BLOCK_TOKEN;
+ if (includesStartBlock) {
+ supportedTokens.addAll(SUPPORTED_START_BLOCK_COMMENT_TOKEN);
+ }
+
+ if (trimmedLineStartsWith(line, EXCLUDED_END_COMMENT_BLOCK_TOKEN) != null) {
+ return null;
+ }
+
+ return trimmedLineStartsWith(line, supportedTokens);
+ }
+
+ private String trimmedLineStartsWith(String line, List<String> supportedTokens) {
+ for (String token : supportedTokens) {
+ if (line.trim().startsWith(token)) {
+ return token;
+ }
+ }
+ return null;
+ }
+
+ boolean isNonEmptyCommentedLine(String line) {
+ String commentToken = getCommentTokenInBlock(line);
+ return commentToken == null || !commentToken.equals(line.trim());
+ }
+
+ String getCommentTokenInBlock(String line) {
+ return getCommentToken(line, false);
+ }
+
+ boolean isCommentLine(String line) {
+ return getCommentToken(line, true) != null;
+ }
+
+}
diff --git a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java
new file mode 100644
index 0000000..b7e0b1d
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java
@@ -0,0 +1,424 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2015 ForgeRock AS
+ */
+package org.forgerock.maven;
+
+import static org.apache.maven.plugins.annotations.LifecyclePhase.*;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.forgerock.util.Utils;
+
+/**
+ * This goals can be used to automatically updates copyrights of modified files.
+ *
+ * <p>
+ * Copyright sections must respect the following format:
+ * <pre>
+ * (.)* //This line references 0..N lines.
+ * [COMMMENT_CHAR][lineBeforeCopyrightToken]
+ * [COMMMENT_CHAR]* //This line references 0..N commented emptylines.
+ * ([COMMMENT_CHAR][oldCopyrightToken])*
+ * ([COMMMENT_CHAR][indent][copyrightStartToken | portionsCopyrightStartToken] [YEAR] [copyrightEndToken])?
+ * </pre>
+ * <p>
+ * Formatter details:
+ * <ul>
+ * <li>COMMENT_CHAR: Auto-detected by plugin.
+ * Comment character used in comment blocks ('*' for Java, '!' for xml...)</li>
+ * <li>lineBeforeCopyrightToken: Parameter
+ * Used by the plugin to start it's inspection for the copyright line.
+ * Next non blank commented lines after this lines must be
+ * old copyright owner lines or/and old copyright lines.</li>
+ *
+ * <li>oldCopyrightToken: Detected by plugin ('copyright' keyword non case-sensitive and non copyrightEndToken)
+ * If one line contains this token, the plugin will use
+ * the portionsCopyrightStartToken instead of copyrightStartToken</li>
+ *
+ * <li>nbLinesToSkip: Parameter (int)
+ * Used only if a new copyright line is needed (not if a new portion copyright section is needed).
+ * It gives the number of lines to add after the line which contains the lineBeforeCopyrightToken.</li>
+ *
+ * <li>indent: Parameter 'numberSpaceIdentation' (int)
+ * Used only if a new copyright or portion copyright line is needed.
+ * It gives the number of space to add after the COMMENT_CHAR.
+ * If there is already a copyright line, the existing indentation will be used.</li>
+ *
+ * <li>copyrightStartToken: Parameter
+ * Used to recognize the copyright line. If the copyright section is
+ * missing, the plugin will add the line.</li>
+ *
+ * <li>portionsCopyrightStartToken: Parameter
+ * Same as copyrightStartToken, but if the oldCopyrightToken is present.</li>
+ *
+ * <li>copyrightEndToken: Parameter
+ * Same as copyrightStartToken, but for the end of the line.</li>
+ *
+ * <li>YEAR: Computed by plugin
+ * Current year if there is no existing copyright line.
+ * If the copyright section already exists, the year will be updated as follow:
+ * <ul>
+ * <li>OLD_YEAR => OLD_YEAR-CURRENT_YEAR</li>
+ * <li>VERY_OLD_YEAR-OLD_YEAR => VERY_OLD_YEAR-CURRENT_YEAR</li>
+ * </ul></li>
+ * </ul>
+ */
+@Mojo(name = "update-copyright", defaultPhase = VALIDATE)
+public class UpdateCopyrightMojo extends CopyrightAbstractMojo {
+
+ private final class UpdateCopyrightFile {
+ private String filePath;
+ private final List<String> bufferedLines = new LinkedList<String>();
+ private boolean copyrightUpdated;
+ private boolean lineBeforeCopyrightReaded;
+ private boolean commentBlockEnded;
+ private boolean portionsCopyrightNeeded;
+ private boolean copyrightSectionPresent;
+ private String curLine;
+ private String curLowerLine;
+ private Integer startYear;
+ private Integer endYear;
+ private BufferedReader reader;
+ private BufferedWriter writer;
+
+ private UpdateCopyrightFile(String filePath) throws IOException {
+ this.filePath = filePath;
+ reader = new BufferedReader(new FileReader(filePath));
+ File tmpFile = new File(filePath + ".tmp");
+ if (!tmpFile.exists()) {
+ tmpFile.createNewFile();
+ }
+ writer = new BufferedWriter(new FileWriter(tmpFile));
+ }
+
+ private void updateCopyrightForFile() throws MojoExecutionException {
+ try {
+ readLineBeforeCopyrightToken();
+ portionsCopyrightNeeded = readOldCopyrightLine();
+ copyrightSectionPresent = readCopyrightLine();
+ writeCopyrightLine();
+ writeChanges();
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ } finally {
+ Utils.closeSilently(reader, writer);
+ }
+ }
+
+ private void writeChanges() throws Exception {
+ while (curLine != null) {
+ nextLine();
+ }
+ reader.close();
+
+ for (String line : bufferedLines) {
+ writer.write(line);
+ writer.newLine();
+ }
+ writer.close();
+
+ if (!dryRun) {
+ File updatedFile = new File(filePath);
+ if (!updatedFile.delete()) {
+ throw new Exception("impossible to perform rename on the file.");
+ }
+ new File(filePath + ".tmp").renameTo(updatedFile);
+ }
+ }
+
+ private void writeCopyrightLine() throws Exception {
+ if (copyrightSectionPresent) {
+ updateExistingCopyrightLine();
+ copyrightUpdated = true;
+ return;
+ }
+
+ int indexAdd = bufferedLines.size() - 1;
+ String stopToken = portionsCopyrightNeeded ? OLD_COPYRIGHT_TOKEN : lineBeforeCopyrightToken;
+ String previousLine = curLine;
+ while (!previousLine.toLowerCase().contains(stopToken.toLowerCase())) {
+ indexAdd--;
+ previousLine = bufferedLines.get(indexAdd);
+ }
+ indexAdd++;
+ StringBuffer newCopyrightLine = new StringBuffer(getNewCommentedLine());
+ newCopyrightLine.append(indent())
+ .append(portionsCopyrightNeeded ? portionsCopyrightStartToken : copyrightStartToken)
+ .append(" ").append(currentYear).append(" ").append(copyrightEndToken);
+ if (!portionsCopyrightNeeded) {
+ for (int i = 0; i < nbLinesToSkip; i++) {
+ bufferedLines.add(indexAdd++, getNewCommentedLine());
+ }
+ }
+ bufferedLines.add(indexAdd, newCopyrightLine.toString());
+ copyrightUpdated = true;
+ }
+
+ private void updateExistingCopyrightLine() throws Exception {
+ if (portionsCopyrightNeeded && copyrightSectionPresent) {
+ // Check if the line is a new copyright line
+ if (curLine.contains(copyrightStartToken) && !curLine.contains(portionsCopyrightStartToken)) {
+ getLog().warn("File " + filePath + " contains old copyright line and coyright line. "
+ + "The copyright line will be replaced by a portion copyright line.");
+ curLine.replace(copyrightStartToken, portionsCopyrightStartToken);
+ }
+ }
+ readYearSection();
+ final String newCopyrightLine;
+ if (endYear == null) {
+ //OLD_YEAR => OLD_YEAR-CURRENT_YEAR
+ newCopyrightLine = curLine.replace(startYear.toString(), intervalToString(startYear, currentYear));
+ } else {
+ //VERY_OLD_YEAR-OLD_YEAR => VERY_OLD_YEAR-CURRENT_YEAR
+ newCopyrightLine = curLine.replace(intervalToString(startYear, endYear),
+ intervalToString(startYear, currentYear));
+ }
+ bufferedLines.remove(bufferedLines.size() - 1);
+ bufferedLines.add(newCopyrightLine);
+ }
+
+ private void readYearSection() throws Exception {
+ try {
+ String startToken = portionsCopyrightNeeded ? portionsCopyrightStartToken : copyrightStartToken;
+ String yearSection = curLine.substring(curLine.indexOf(startToken) + startToken.length(),
+ curLine.indexOf(copyrightEndToken)).trim();
+ if (yearSection.contains("-")) {
+ startYear = Integer.parseInt(yearSection.split("-")[0].trim());
+ endYear = Integer.parseInt(yearSection.split("-")[1].trim());
+ } else {
+ startYear = Integer.parseInt(yearSection);
+ }
+ } catch (NumberFormatException nfe) {
+ throw new Exception("Malformed year section in copyright line " + curLine);
+ } catch (Exception e) {
+ throw new Exception("Malformed copyright line " + curLine);
+ }
+ }
+
+ private void readLineBeforeCopyrightToken() throws Exception {
+ nextLine();
+ while (curLine != null) {
+ if (curLine.contains(lineBeforeCopyrightToken)) {
+ if (!isCommentLine(curLowerLine)) {
+ throw new Exception("The line before copyright token must be a commented line");
+ }
+ lineBeforeCopyrightReaded = true;
+ return;
+ } else if (commentBlockEnded) {
+ throw new Exception("unexpected non commented line found before copyright section");
+ }
+ nextLine();
+ }
+ }
+
+ private boolean readOldCopyrightLine() throws Exception {
+ nextLine();
+ while (curLine != null) {
+ if (isOldCopyrightOwnerLine()) {
+ return true;
+ } else if (isNonEmptyCommentedLine(curLine)
+ || isCopyrightLine()
+ || commentBlockEnded) {
+ return false;
+ }
+ nextLine();
+ }
+ throw new Exception("unexpected end of file while trying to read copyright");
+ }
+
+ private boolean readCopyrightLine() throws Exception {
+ while (curLine != null) {
+ if (isCopyrightLine()) {
+ return true;
+ } else if ((isNonEmptyCommentedLine(curLine) && !isOldCopyrightOwnerLine())
+ || commentBlockEnded) {
+ return false;
+ }
+ nextLine();
+ }
+ throw new Exception("unexpected end of file while trying to read copyright");
+ }
+
+ private boolean isOldCopyrightOwnerLine() {
+ return curLowerLine.contains(OLD_COPYRIGHT_TOKEN) && !curLine.contains(copyrightEndToken);
+ }
+
+ private boolean isCopyrightLine() {
+ return (curLine.contains(copyrightStartToken) || curLine.contains(portionsCopyrightStartToken))
+ && curLine.contains(copyrightEndToken);
+ }
+
+ private void nextLine() throws Exception {
+ curLine = reader.readLine();
+ if (curLine == null && !copyrightUpdated) {
+ throw new Exception("unexpected end of file while trying to read copyright");
+ } else if (curLine != null) {
+ bufferedLines.add(curLine);
+ }
+
+ if (!copyrightUpdated) {
+ curLowerLine = curLine.trim().toLowerCase();
+ if (lineBeforeCopyrightReaded && !isCommentLine(curLowerLine)) {
+ commentBlockEnded = true;
+ }
+ }
+ }
+
+ private String getNewCommentedLine() throws Exception {
+ int indexCommentToken = 1;
+ String commentToken = null;
+ String linePattern = null;
+ while (bufferedLines.size() > indexCommentToken && commentToken == null) {
+ linePattern = bufferedLines.get(indexCommentToken++);
+ commentToken = getCommentTokenInBlock(linePattern);
+ }
+ if (commentToken != null) {
+ return linePattern.substring(0, linePattern.indexOf(commentToken) + 1);
+ } else {
+ throw new Exception("Uncompatibles comments lines in the file.");
+ }
+ }
+
+ }
+
+ private static final String OLD_COPYRIGHT_TOKEN = "copyright";
+
+ /** The last non empty commented line before the copyright section. */
+ @Parameter(required = true, defaultValue = "CDDL HEADER END")
+ private String lineBeforeCopyrightToken;
+
+ /**
+ * Number of lines to add after the line which contains the lineBeforeCopyrightToken.
+ * Used only if a new copyright line is needed.
+ */
+ @Parameter(required = true, defaultValue = "2")
+ private Integer nbLinesToSkip;
+
+ /**
+ * Number of spaces to add after the comment line token before adding new
+ * copyright section. Used only if a new copyright or portion copyright is
+ * needed.
+ */
+ @Parameter(required = true, defaultValue = "6")
+ private Integer numberSpaceIdentation;
+
+ /** Copyright start line token. */
+ @Parameter(required = true, defaultValue = "Copyright")
+ private String copyrightStartToken;
+
+ @Parameter(required = true, defaultValue = "Portions Copyright")
+ /** Portions copyright start line token. */
+ private String portionsCopyrightStartToken;
+
+ /** Copyright end line token. */
+ @Parameter(required = true, defaultValue = "ForgeRock AS")
+ private String copyrightEndToken;
+
+ /** A dry run will not change source code. It creates new files with '.tmp' extension */
+ @Parameter(required = true, defaultValue = "false")
+ private boolean dryRun;
+
+ private boolean buildOK = true;
+
+ /**
+ * Updates copyright of modified files.
+ *
+ * @throws MojoFailureException
+ * if any
+ * @throws MojoExecutionException
+ * if any
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ checkCopyrights();
+ for (String filePath : getIncorrectCopyrightFilePaths()) {
+ try {
+ new UpdateCopyrightFile(filePath).updateCopyrightForFile();
+ getLog().info("Copyright of file " + filePath + " has been successfully updated.");
+ } catch (Exception e) {
+ getLog().error("Impossible to update copyright of file " + filePath);
+ getLog().error(" Details: " + e.getMessage());
+ getLog().error(" No modification has been performed on this file");
+ buildOK = false;
+ }
+ }
+
+ if (!buildOK) {
+ throw new MojoFailureException("Error(s) occured while trying to update some copyrights.");
+ }
+ }
+
+ private String intervalToString(Integer startYear, Integer endYear) {
+ return startYear.toString() + "-" + endYear;
+ }
+
+ private String indent() {
+ String indentation = "";
+ for (int i = 0; i < numberSpaceIdentation; i++) {
+ indentation += " ";
+ }
+ return indentation;
+ }
+
+ // Setters to allow tests
+
+ void setLineBeforeCopyrightToken(String lineBeforeCopyrightToken) {
+ this.lineBeforeCopyrightToken = lineBeforeCopyrightToken;
+ }
+
+ void setNbLinesToSkip(Integer nbLinesToSkip) {
+ this.nbLinesToSkip = nbLinesToSkip;
+ }
+
+ void setNumberSpaceIdentation(Integer numberSpaceIdentation) {
+ this.numberSpaceIdentation = numberSpaceIdentation;
+ }
+
+ void setPortionsCopyrightStartToken(String portionsCopyrightStartToken) {
+ this.portionsCopyrightStartToken = portionsCopyrightStartToken;
+ }
+
+ void setCopyrightStartToken(String copyrightStartToken) {
+ this.copyrightStartToken = copyrightStartToken;
+ }
+
+ void setCopyrightEndToken(String copyrightEndToken) {
+ this.copyrightEndToken = copyrightEndToken;
+ }
+
+ void setDryRun(final boolean dryRun) {
+ this.dryRun = true;
+ }
+
+}
diff --git a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/package-info.java b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/package-info.java
new file mode 100644
index 0000000..d9b45f5
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/package-info.java
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2015 ForgeRock AS.
+ */
+
+/** Classes implementing the maven plugin to check and update source file copyrights. */
+package org.forgerock.maven;
+
diff --git a/opendj-copyright-maven-plugin/src/test/java/org/forgerock/maven/UpdateCopyrightTestCase.java b/opendj-copyright-maven-plugin/src/test/java/org/forgerock/maven/UpdateCopyrightTestCase.java
new file mode 100644
index 0000000..0c282cb
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/java/org/forgerock/maven/UpdateCopyrightTestCase.java
@@ -0,0 +1,182 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2015 ForgeRock AS.
+ */
+package org.forgerock.maven;
+
+import static org.mockito.Mockito.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.forgerock.testng.ForgeRockTestCase;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+@Test
+public class UpdateCopyrightTestCase extends ForgeRockTestCase {
+
+ private static final String CURRENT_YEAR = Integer.toString(Calendar.getInstance().get(Calendar.YEAR));
+ private static final String RESOURCE_DIR = "src/test/resources/files/";
+ private static final String[] TEST_FOLDERS = new String[] {"openam-copyrights",
+ "opendj-copyrights", "openidm-copyrights"};
+
+ /** Customs tags in tests files */
+ private static final String MUST_BE_REMOVE_TAG = "MUST BE REMOVED:";
+ private static final String EXPECTED_OUTPUT_TAG = "EXPECTED OUTPUT:";
+ private static final String YEAR_TAG = "YEAR";
+
+
+ @AfterTest
+ public void deleteTempFiles() {
+ for (String testFolder : TEST_FOLDERS) {
+ for (File file : new File(RESOURCE_DIR, testFolder).listFiles()) {
+ if (file.getPath().endsWith(".tmp")) {
+ file.delete();
+ }
+ }
+ }
+ }
+
+
+ @DataProvider
+ public Object[][] testCases() {
+ return new Object[][] {
+ // Test case folder, Line before copyright token, NB lines to skip, NB spaces indentation,
+ // Portion copyright token, Copyright start token, Copyright end token
+ { TEST_FOLDERS[0], "Portions copyright [year] [name of copyright owner]", 1, 1,
+ "Portions copyright", "Copyright", "ForgeRock AS." },
+ { TEST_FOLDERS[1], "CDDL HEADER END", 1, 6, "Portions Copyright", "Copyright", "ForgeRock AS." },
+ { TEST_FOLDERS[2], "DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.", 1, 1,
+ "Portions Copyrighted", "Copyright (c)", "ForgeRock AS. All rights reserved." }
+ };
+ }
+
+ @Test(dataProvider = "testCases")
+ public void testUpdateCopyright(String testCaseFolderPath, String lineBeforeCopyrightToken,
+ Integer nbLinesToSkip, Integer numberSpacesIndentation, String portionCopyrightToken,
+ String copyrightStartToken, String copyrightEndToken) throws Exception {
+ List<String> testFilePaths = new LinkedList<String>();
+ List<String> updatedTestFilePaths = new LinkedList<String>();
+ File[] changedFiles = new File(RESOURCE_DIR, testCaseFolderPath).listFiles();
+ for (File file : changedFiles) {
+ if (file.getPath().endsWith(".tmp")) {
+ continue;
+ }
+ testFilePaths.add(file.getAbsolutePath());
+ updatedTestFilePaths.add(file.getPath() + ".tmp");
+ }
+
+ UpdateCopyrightMojo spyMojo = spy(new UpdateCopyrightMojo());
+ spyMojo.setDryRun(true);
+ spyMojo.setLineBeforeCopyrightToken(lineBeforeCopyrightToken);
+ spyMojo.setNbLinesToSkip(nbLinesToSkip);
+ spyMojo.setNumberSpaceIdentation(numberSpacesIndentation);
+ spyMojo.setPortionsCopyrightStartToken(portionCopyrightToken);
+ spyMojo.setCopyrightStartToken(copyrightStartToken);
+ spyMojo.setCopyrightEndToken(copyrightEndToken);
+
+ doNothing().when(spyMojo).checkCopyrights();
+ when(spyMojo.getIncorrectCopyrightFilePaths()).thenReturn(testFilePaths);
+ spyMojo.execute();
+
+ // Check copyrights of updated files
+ CheckCopyrightMojo spyMojoCheck = spy(new CheckCopyrightMojo());
+ doReturn(updatedTestFilePaths).when(spyMojoCheck).getChangedFiles();
+ spyMojoCheck.execute();
+
+ // Check updated files content
+ for (String filePath : testFilePaths) {
+ checkMofidiedFile(filePath);
+ }
+ }
+
+
+ private void checkMofidiedFile(String filePath) throws Exception {
+ final BufferedReader reader = new BufferedReader(new FileReader(filePath));
+ String mustBeRemoved = null;
+ String expectedOutput = null;
+ String currentLine = reader.readLine();
+ while (currentLine != null) {
+ if (currentLine.contains(MUST_BE_REMOVE_TAG)) {
+ mustBeRemoved = currentLine.split(MUST_BE_REMOVE_TAG)[1].trim();
+ } else if (currentLine.contains(EXPECTED_OUTPUT_TAG)) {
+ expectedOutput = currentLine.split(EXPECTED_OUTPUT_TAG)[1].trim()
+ .replace(YEAR_TAG, CURRENT_YEAR);
+ }
+ currentLine = reader.readLine();
+ }
+ reader.close();
+ checkIfNewFileIsValid(mustBeRemoved, expectedOutput, filePath + ".tmp");
+ }
+
+
+ private void checkIfNewFileIsValid(String mustBeRemoved, String expectedOutput, String filePath) throws Exception {
+ if (mustBeRemoved == null && expectedOutput == null) {
+ return;
+ }
+
+ final BufferedReader reader = new BufferedReader(new FileReader(filePath));
+ String currentLine = reader.readLine();
+ boolean expectedOutputFound = false;
+
+ while (currentLine != null) {
+ if (lineContainsTagContent(currentLine, mustBeRemoved)) {
+ reader.close();
+ throw new Exception("Generated file " + filePath + " must not contains " + mustBeRemoved);
+ }
+
+ if (!expectedOutputFound && lineContainsTagContent(currentLine, expectedOutput)) {
+ expectedOutputFound = true;
+ if (mustBeRemoved == null) {
+ reader.close();
+ return;
+ }
+ }
+ currentLine = reader.readLine();
+ }
+ reader.close();
+
+ if (!expectedOutputFound) {
+ throw new Exception("Generated file " + filePath + " should contains " + expectedOutput);
+ }
+ }
+
+
+ private boolean lineContainsTagContent(String line, String content) {
+ String trimedLine = line.trim();
+ return content != null
+ && !trimedLine.startsWith(MUST_BE_REMOVE_TAG)
+ && !trimedLine.startsWith(MUST_BE_REMOVE_TAG)
+ && trimedLine.contains(content);
+ }
+
+
+
+}
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt
new file mode 100644
index 0000000..090cf59
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt
@@ -0,0 +1,18 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2012-2014 ForgeRock AS.
+ */
+
+ MUST BE REMOVED: Copyright 2012-2014 ForgeRock AS.
+ EXPECTED OUTPUT: Copyright 2012-YEAR ForgeRock AS.
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt
new file mode 100644
index 0000000..12b4977
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt
@@ -0,0 +1,19 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2010 ForgeRock AS.
+ */
+
+MUST BE REMOVED: Copyright 2010 ForgeRock AS.
+EXPECTED OUTPUT: Copyright 2010-YEAR ForgeRock AS.
+
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt
new file mode 100644
index 0000000..f829e82
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt
@@ -0,0 +1,16 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions copyright [year] [name of copyright owner]".
+ *
+ */
+
+ EXPECTED OUTPUT: Copyright YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-4.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-4.txt
new file mode 100644
index 0000000..44007f7
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-4.txt
@@ -0,0 +1,17 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2010 Old Copyright Owner Inc.
+ */
+
+ EXPECTED OUTPUT: Portions copyright YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-5.txt
new file mode 100644
index 0000000..cddb5aa
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-5.txt
@@ -0,0 +1,18 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2010-2012 Very Old copyright owner Inc.
+ * Copyright 2013-2014 Old copyright owner Inc.
+ */
+
+ EXPECTED OUTPUT: Portions copyright YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-6.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-6.txt
new file mode 100644
index 0000000..29824e6
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-6.txt
@@ -0,0 +1,20 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2008-2010 Very Old copyright owner Inc.
+ * Portions copyright 2011-2012 Old copyright owner Inc.
+ * Portions copyright 2013-2014 ForgeRock AS.
+ */
+
+MUST BE REMOVED: Portions copyright 2013-2014 ForgeRock AS.
+EXPECTED OUTPUT: Portions copyright 2013-YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-1.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-1.txt
new file mode 100644
index 0000000..8fd32e3
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-1.txt
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License"). You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ ! or http://forgerock.org/license/CDDLv1.0.html.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at legal-notices/CDDLv1_0.txt.
+ ! If applicable, add the following below this CDDL HEADER, with the
+ ! fields enclosed by brackets "[]" replaced with your own identifying
+ ! information:
+ ! Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ ! Copyright 2012-2014 ForgeRock AS.
+-->
+
+MUST BE REMOVED: Copyright 2012-2014 ForgeRock AS.
+EXPECTED OUTPUT: Copyright 2012-YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt
new file mode 100644
index 0000000..4c140eb
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt
@@ -0,0 +1,27 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2013 ForgeRock AS.
+ */
+
+MUST BE REMOVED: Copyright 2013 ForgeRock AS.
+EXPECTED OUTPUT: Copyright 2013-YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt
new file mode 100644
index 0000000..e5f6721
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt
@@ -0,0 +1,25 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ */
+
+EXPECTED OUTPUT: Copyright YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt
new file mode 100644
index 0000000..1537c57
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt
@@ -0,0 +1,27 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2010-2013 Old Copyright Owner Inc.
+ *
+ */
+
+EXPECTED OUTPUT: Portions Copyright YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt
new file mode 100644
index 0000000..e55a43c
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt
@@ -0,0 +1,27 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2010-2012 Very Old copyright owner Inc.
+ * Copyright 2013-2014 Old copyright owner Inc.
+ */
+
+EXPECTED OUTPUT: Portions Copyright YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt
new file mode 100644
index 0000000..6d1fdca
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2008-2010 Very Old copyright owner Inc.
+ * Portions Copyright 2011-2012 Old copyright owner Inc.
+ * Portions Copyright 2013-2014 ForgeRock AS.
+ */
+
+MUST BE REMOVED: Portions Copyright 2013-2014 ForgeRock AS.
+EXPECTED OUTPUT: Portions Copyright 2013-YEAR ForgeRock AS.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt
new file mode 100644
index 0000000..2a1a77a
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt
@@ -0,0 +1,26 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2011-2014 ForgeRock AS. All rights reserved.
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ */
+
+MUST BE REMOVED: Copyright (c) 2011-2014 ForgeRock AS. All rights reserved.
+EXPECTED OUTPUT: Copyright (c) 2011-YEAR ForgeRock AS. All rights reserved.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt
new file mode 100644
index 0000000..d748d88
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt
@@ -0,0 +1,26 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2012 ForgeRock AS. All rights reserved.
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ */
+
+MUST BE REMOVED: Copyright (c) 2012 ForgeRock AS. All rights reserved.
+EXPECTED OUTPUT: Copyright (c) 2012-YEAR ForgeRock AS. All rights reserved.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt
new file mode 100644
index 0000000..20a378f
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt
@@ -0,0 +1,24 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ */
+
+EXPECTED OUTPUT: Copyright (c) YEAR ForgeRock AS. All rights reserved.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt
new file mode 100644
index 0000000..3ebce6b
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt
@@ -0,0 +1,25 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2010-2011 Old Copyright Owner.
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ */
+
+ EXPECTED OUTPUT: Portions Copyrighted YEAR ForgeRock AS. All rights reserved.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt
new file mode 100644
index 0000000..2e8c5d9
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt
@@ -0,0 +1,26 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2010-2011 Very Old Copyright Owner.
+ * Copyright (c) 2012-2013 Old Copyright Owner.
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ */
+
+ EXPECTED OUTPUT: Portions Copyrighted YEAR ForgeRock AS. All rights reserved.
\ No newline at end of file
diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt
new file mode 100644
index 0000000..6b4f8e5
--- /dev/null
+++ b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt
@@ -0,0 +1,28 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2010-2011 Very Old Copyright Owner.
+ * Portions Copyrighted 2012-2013 Old Copyright Owner.
+ * Portions Copyrighted 2013-2014 ForgeRock AS. All rights reserved.
+ *
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ * http://forgerock.org/license/CDDLv1.0.html
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at http://forgerock.org/license/CDDLv1.0.html
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ */
+
+MUST BE REMOVED: Portions Copyrighted 2013-2014 ForgeRock AS. All rights reserved.
+EXPECTED OUTPUT: Portions Copyrighted 2013-YEAR ForgeRock AS. All rights reserved.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f3c8e75..8f784aa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,6 +91,7 @@
</distributionManagement>
<modules>
<module>opendj-maven-plugin</module>
+ <module>opendj-copyright-maven-plugin</module>
<module>opendj-svn-property-check-maven-plugin</module>
<module>opendj-core</module>
<module>opendj-grizzly</module>
@@ -490,4 +491,26 @@
<distribution>repo</distribution>
</license>
</licenses>
+<!-- <profiles> -->
+<!-- <profile> -->
+<!-- <id>precommit</id> -->
+<!-- <build> -->
+<!-- <plugins> -->
+<!-- <plugin> -->
+<!-- <groupId>org.forgerock.opendj</groupId> -->
+<!-- <artifactId>opendj-copyright-maven-plugin</artifactId> -->
+<!-- <version>1.0.0-SNAPSHOT</version> -->
+<!-- <executions> -->
+<!-- <execution> -->
+<!-- <id>check-copyrights</id> -->
+<!-- <goals> -->
+<!-- <goal>check-copyright</goal> -->
+<!-- </goals> -->
+<!-- </execution> -->
+<!-- </executions> -->
+<!-- </plugin> -->
+<!-- </plugins> -->
+<!-- </build> -->
+<!-- </profile> -->
+<!-- </profiles> -->
</project>
--
Gitblit v1.10.0