From 84208109b893f7d174ec19e839a97c7312e3f83d Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Thu, 26 Feb 2015 17:49:52 +0000
Subject: [PATCH] OPENDJ-1769: Improve copyright maven plugin code
---
opendj-copyright-maven-plugin/src/test/java/org/forgerock/maven/UpdateCopyrightTestCase.java | 27 +++--
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt | 6
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-1.txt | 6
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt | 6
opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/UpdateCopyrightMojo.java | 193 ++++++++++++++++++++++----------------
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt | 2
opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java | 4
pom.xml | 30 +++++
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt | 2
opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt | 2
opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-5.txt | 4
opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt | 2
12 files changed, 173 insertions(+), 111 deletions(-)
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
index 9f2f447..74952fa 100644
--- 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
@@ -74,8 +74,8 @@
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.");
+ getLog().warn("You can use copyrights-update profile (mvn -Pprecommit -Pcopyriths-update) "
+ + "to automatically update copyrights.");
throw new MojoExecutionException("Found files with potential copyright year updates needed");
}
} else {
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
index 4540498..c33e40e 100644
--- 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
@@ -24,6 +24,8 @@
*/
package org.forgerock.maven;
+import static java.util.regex.Pattern.*;
+
import static org.apache.maven.plugins.annotations.LifecyclePhase.*;
import java.io.BufferedReader;
@@ -34,6 +36,8 @@
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -48,43 +52,29 @@
* 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][lineBeforeCopyrightRegExp]
+ * [COMMMENT_CHAR]* //This line references 0..N commented empty lines.
* ([COMMMENT_CHAR][oldCopyrightToken])*
- * ([COMMMENT_CHAR][indent][copyrightStartToken | portionsCopyrightStartToken] [YEAR] [copyrightEndToken])?
+ * ([COMMMENT_CHAR] [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
+ *
+ * <li>lineBeforeCopyrightRegExp: Parameter regExp case insensitive
* 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>
+ * old copyright owner lines or/and old ForgeRock copyright lines.</li>
*
- * <li>oldCopyrightToken: Detected by plugin ('copyright' keyword non case-sensitive and non copyrightEndToken)
+ * <li>oldCopyrightToken: Detected by plugin ('copyright' keyword case insensitive)
* If one line contains this token, the plugin will use
- * the portionsCopyrightStartToken instead of copyrightStartToken</li>
+ * the newPortionsCopyrightLabel instead of the newCopyrightLabel
+ * if there is no ForgeRock copyrighted line.</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>forgerockCopyrightRegExp: Parameter regExp case insensitive
+ * The regular expression which identifies a copyrighted line as a ForgeRock one.</li>
*
* <li>YEAR: Computed by plugin
* Current year if there is no existing copyright line.
@@ -94,12 +84,31 @@
* <li>VERY_OLD_YEAR-OLD_YEAR => VERY_OLD_YEAR-CURRENT_YEAR</li>
* </ul></li>
* </ul>
+ * </p>
+ * <p>
+ * If no ForgeRock copyrighted line is detected, the plugin will add according to the following format
+ * <ul>
+ * <li> If there is one or more old copyright lines:
+ * <pre>
+ * [COMMMENT_CHAR][lineBeforeCopyrightRegExp]
+ * [COMMMENT_CHAR]* //This line references 0..N commented empty lines.
+ * ([COMMMENT_CHAR][oldCopyrightToken])*
+ * [indent][newPortionsCopyrightLabel] [YEAR] [forgerockCopyrightLabel]
+ * </pre></li><br>
+ * <li> If there is no old copyright lines:
+ * <pre>
+ * [COMMMENT_CHAR][lineBeforeCopyrightRegExp]
+ * [COMMMENT_CHAR]*{nbLinesToSkip} //This line nbLinesToSkip commented empty lines.
+ * [indent][newCopyrightLabel] [YEAR] [forgerockCopyrightLabel]
+ * </pre></li>
+ * </ul>
+ *
*/
@Mojo(name = "update-copyright", defaultPhase = VALIDATE)
public class UpdateCopyrightMojo extends CopyrightAbstractMojo {
private final class UpdateCopyrightFile {
- private String filePath;
+ private final String filePath;
private final List<String> bufferedLines = new LinkedList<String>();
private boolean copyrightUpdated;
private boolean lineBeforeCopyrightReaded;
@@ -110,13 +119,13 @@
private String curLowerLine;
private Integer startYear;
private Integer endYear;
- private BufferedReader reader;
- private BufferedWriter writer;
+ private final BufferedReader reader;
+ private final BufferedWriter writer;
private UpdateCopyrightFile(String filePath) throws IOException {
this.filePath = filePath;
reader = new BufferedReader(new FileReader(filePath));
- File tmpFile = new File(filePath + ".tmp");
+ final File tmpFile = new File(filePath + ".tmp");
if (!tmpFile.exists()) {
tmpFile.createNewFile();
}
@@ -130,7 +139,7 @@
copyrightSectionPresent = readCopyrightLine();
writeCopyrightLine();
writeChanges();
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
} finally {
Utils.closeSilently(reader, writer);
@@ -143,14 +152,14 @@
}
reader.close();
- for (String line : bufferedLines) {
+ for (final String line : bufferedLines) {
writer.write(line);
writer.newLine();
}
writer.close();
if (!dryRun) {
- File updatedFile = new File(filePath);
+ final File updatedFile = new File(filePath);
if (!updatedFile.delete()) {
throw new Exception("impossible to perform rename on the file.");
}
@@ -166,9 +175,10 @@
}
int indexAdd = bufferedLines.size() - 1;
- String stopToken = portionsCopyrightNeeded ? OLD_COPYRIGHT_TOKEN : lineBeforeCopyrightToken;
+ final Pattern stopRegExp = portionsCopyrightNeeded ? OLD_COPYRIGHT_REGEXP
+ : lineBeforeCopyrightCompiledRegExp;
String previousLine = curLine;
- while (!previousLine.toLowerCase().contains(stopToken.toLowerCase())) {
+ while (!lineMatches(previousLine, stopRegExp)) {
indexAdd--;
previousLine = bufferedLines.get(indexAdd);
}
@@ -179,27 +189,20 @@
}
}
final String newCopyrightLine = getNewCommentedLine()
- + indent() + (portionsCopyrightNeeded ? portionsCopyrightStartToken : copyrightStartToken)
- + " " + currentYear + " " + copyrightEndToken;
+ + indent() + (portionsCopyrightNeeded ? newPortionsCopyrightLabel : newCopyrightLabel)
+ + " " + currentYear + " " + forgeRockCopyrightLabel;
bufferedLines.add(indexAdd, newCopyrightLine);
copyrightUpdated = true;
}
private void updateExistingCopyrightLine() throws Exception {
- if (portionsCopyrightNeeded && copyrightSectionPresent
- // Is it a new copyright line?
- && 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 portions copyright line.");
- curLine.replace(copyrightStartToken, portionsCopyrightStartToken);
- }
readYearSection();
final String newCopyrightLine;
if (endYear == null) {
- //OLD_YEAR => OLD_YEAR-CURRENT_YEAR
+ // 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
+ // VERY_OLD_YEAR-OLD_YEAR => VERY_OLD_YEAR-CURRENT_YEAR
newCopyrightLine = curLine.replace(intervalToString(startYear, endYear),
intervalToString(startYear, currentYear));
}
@@ -208,27 +211,23 @@
}
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);
+ final String copyrightLineRegExp = ".*\\s+(\\d{4})(-(\\d{4}))?\\s+" + forgerockCopyrightRegExp + ".*";
+ final Matcher copyrightMatcher = Pattern.compile(copyrightLineRegExp, CASE_INSENSITIVE).matcher(curLine);
+ if (copyrightMatcher.matches()) {
+ startYear = Integer.parseInt(copyrightMatcher.group(1));
+ final String endYearString = copyrightMatcher.group(3);
+ if (endYearString != null) {
+ endYear = Integer.parseInt(endYearString);
}
- } catch (NumberFormatException nfe) {
+ } else {
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 (curLineMatches(lineBeforeCopyrightCompiledRegExp)) {
if (!isCommentLine(curLowerLine)) {
throw new Exception("The line before copyright token must be a commented line");
}
@@ -270,12 +269,19 @@
}
private boolean isOldCopyrightOwnerLine() {
- return curLowerLine.contains(OLD_COPYRIGHT_TOKEN) && !curLine.contains(copyrightEndToken);
+ return curLineMatches(OLD_COPYRIGHT_REGEXP) && !curLineMatches(copyrightOwnerCompiledRegExp);
}
private boolean isCopyrightLine() {
- return (curLine.contains(copyrightStartToken) || curLine.contains(portionsCopyrightStartToken))
- && curLine.contains(copyrightEndToken);
+ return curLineMatches(copyrightOwnerCompiledRegExp);
+ }
+
+ private boolean curLineMatches(Pattern compiledRegExp) {
+ return lineMatches(curLine, compiledRegExp);
+ }
+
+ private boolean lineMatches(String line, Pattern compiledRegExp) {
+ return compiledRegExp.matcher(line).matches();
}
private void nextLine() throws Exception {
@@ -311,11 +317,7 @@
}
- 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;
+ private static final Pattern OLD_COPYRIGHT_REGEXP = Pattern.compile(".*copyright.*", CASE_INSENSITIVE);
/**
* Number of lines to add after the line which contains the lineBeforeCopyrightToken.
@@ -332,24 +334,37 @@
@Parameter(required = true, defaultValue = "6")
private Integer numberSpaceIdentation;
- /** Copyright start line token. */
+ /** The last non empty commented line before the copyright section. */
+ @Parameter(required = true, defaultValue = "CDDL\\s+HEADER\\s+END")
+ private String lineBeforeCopyrightRegExp;
+
+ /** The regular expression which identifies a copyrighted line. */
+ @Parameter(required = true, defaultValue = "ForgeRock\\s+AS")
+ private String forgerockCopyrightRegExp;
+
+ /** Line to add if there is no existing copyright. */
@Parameter(required = true, defaultValue = "Copyright")
- private String copyrightStartToken;
+ private String newCopyrightLabel;
- @Parameter(required = true, defaultValue = "Portions Copyright")
/** Portions copyright start line token. */
- private String portionsCopyrightStartToken;
+ @Parameter(required = true, defaultValue = "Portions Copyright")
+ private String newPortionsCopyrightLabel;
- /** Copyright end line token. */
- @Parameter(required = true, defaultValue = "ForgeRock AS")
- private String copyrightEndToken;
+ /** ForgeRock copyright label to print if a new (portions) copyright line is needed. */
+ @Parameter(required = true, defaultValue = "ForgeRock AS.")
+ private String forgeRockCopyrightLabel;
- /** A dry run will not change source code. It creates new files with '.tmp' extension */
+ /** A dry run will not change source code. It creates new files with '.tmp' extension. */
@Parameter(required = true, defaultValue = "false")
private boolean dryRun;
+ /** RegExps corresponding to user token. */
+ private Pattern lineBeforeCopyrightCompiledRegExp;
+ private Pattern copyrightOwnerCompiledRegExp;
+
private boolean buildOK = true;
+
/**
* Updates copyright of modified files.
*
@@ -360,12 +375,13 @@
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
+ compileRegExps();
checkCopyrights();
- for (String filePath : getIncorrectCopyrightFilePaths()) {
+ for (final String filePath : getIncorrectCopyrightFilePaths()) {
try {
new UpdateCopyrightFile(filePath).updateCopyrightForFile();
getLog().info("Copyright of file " + filePath + " has been successfully updated.");
- } catch (Exception e) {
+ } catch (final 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");
@@ -378,6 +394,15 @@
}
}
+ private void compileRegExps() {
+ lineBeforeCopyrightCompiledRegExp = compileRegExp(lineBeforeCopyrightRegExp);
+ copyrightOwnerCompiledRegExp = compileRegExp(forgerockCopyrightRegExp);
+ }
+
+ private Pattern compileRegExp(String regExp) {
+ return Pattern.compile(".*" + regExp + ".*", CASE_INSENSITIVE);
+ }
+
private String intervalToString(Integer startYear, Integer endYear) {
return startYear + "-" + endYear;
}
@@ -393,7 +418,7 @@
// Setters to allow tests
void setLineBeforeCopyrightToken(String lineBeforeCopyrightToken) {
- this.lineBeforeCopyrightToken = lineBeforeCopyrightToken;
+ this.lineBeforeCopyrightRegExp = lineBeforeCopyrightToken;
}
void setNbLinesToSkip(Integer nbLinesToSkip) {
@@ -404,16 +429,20 @@
this.numberSpaceIdentation = numberSpaceIdentation;
}
- void setPortionsCopyrightStartToken(String portionsCopyrightStartToken) {
- this.portionsCopyrightStartToken = portionsCopyrightStartToken;
+ void setNewPortionsCopyrightString(String portionsCopyrightString) {
+ this.newPortionsCopyrightLabel = portionsCopyrightString;
}
- void setCopyrightStartToken(String copyrightStartToken) {
- this.copyrightStartToken = copyrightStartToken;
+ void setNewCopyrightOwnerString(String newCopyrightOwnerString) {
+ this.forgeRockCopyrightLabel = newCopyrightOwnerString;
+ }
+
+ void setNewCopyrightStartToken(String copyrightStartString) {
+ this.newCopyrightLabel = copyrightStartString;
}
void setCopyrightEndToken(String copyrightEndToken) {
- this.copyrightEndToken = copyrightEndToken;
+ this.forgerockCopyrightRegExp = copyrightEndToken;
}
void setDryRun(final boolean dryRun) {
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
index c04c408..429f4ec 100644
--- 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
@@ -79,20 +79,24 @@
@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 case folder, Line before copyright regexp, NB lines to skip, NB spaces indentation,
+ // New portion copyright string, New copyright start string, Copyright end regexp,
+ // New copyright end String
+ { TEST_FOLDERS[0], "Portions\\s+Copyright\\s+\\[year\\]\\s+\\[name\\s+of\\s+copyright\\s+owner\\]",
+ 1, 1, "Portions copyright", "Copyright", "ForgeRock\\s+AS", "ForgeRock AS." },
+ { TEST_FOLDERS[1], "CDDL\\s+HEADER\\s+END", 1, 6, "Portions Copyright", "Copyright",
+ "ForgeRock\\s+AS\\.", "ForgeRock AS." },
+ { TEST_FOLDERS[2],
+ "DO\\s+NOT\\s+ALTER\\s+OR\\s+REMOVE\\s+COPYRIGHT\\s+NOTICES\\s+OR\\s+THIS\\s+HEADER.", 1, 1,
+ "Portions Copyrighted", "Copyright (c)", "ForgeRock\\s+AS\\.",
+ "ForgeRock AS. All rights reserved." }
};
}
@Test(dataProvider = "testCases")
public void testUpdateCopyright(String testCaseFolderPath, String lineBeforeCopyrightToken,
- int nbLinesToSkip, int numberSpacesIndentation, String portionCopyrightToken,
- String copyrightStartToken, String copyrightEndToken) throws Exception {
+ int nbLinesToSkip, int numberSpacesIndentation, String newPortionCopyrightString,
+ String newCopyrightStartString, String copyrightEndToken, String newCopyrightOwnerStr) throws Exception {
List<String> testFilePaths = new LinkedList<String>();
List<String> updatedTestFilePaths = new LinkedList<String>();
@@ -108,8 +112,9 @@
spyMojo.setLineBeforeCopyrightToken(lineBeforeCopyrightToken);
spyMojo.setNbLinesToSkip(nbLinesToSkip);
spyMojo.setNumberSpaceIdentation(numberSpacesIndentation);
- spyMojo.setPortionsCopyrightStartToken(portionCopyrightToken);
- spyMojo.setCopyrightStartToken(copyrightStartToken);
+ spyMojo.setNewPortionsCopyrightString(newPortionCopyrightString);
+ spyMojo.setNewCopyrightStartToken(newCopyrightStartString);
+ spyMojo.setNewCopyrightOwnerString(newCopyrightOwnerStr);
spyMojo.setCopyrightEndToken(copyrightEndToken);
doNothing().when(spyMojo).checkCopyrights();
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
index 12b4977..e8020b8 100644
--- 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
@@ -11,9 +11,9 @@
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
- * Copyright 2010 ForgeRock AS.
+ * Copyright 2010 ForgeRock AS.
*/
-MUST BE REMOVED: Copyright 2010 ForgeRock AS.
-EXPECTED OUTPUT: Copyright 2010-YEAR 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-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-5.txt
index cddb5aa..8efdebd 100644
--- 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
@@ -11,8 +11,8 @@
* 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.
+ * 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-1.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-1.txt
index 8fd32e3..06a8eb1 100644
--- 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
@@ -21,8 +21,8 @@
!
! CDDL HEADER END
!
- ! Copyright 2012-2014 ForgeRock AS.
+ ! 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
+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-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt
index e55a43c..1c120bb 100644
--- 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
@@ -20,7 +20,7 @@
*
* CDDL HEADER END
*
- * Copyright 2010-2012 Very Old copyright owner Inc.
+ * Copyright 2010-2012 Very Old copyright owner Inc.
* Copyright 2013-2014 Old copyright owner Inc.
*/
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
index 6d1fdca..0c3a822 100644
--- 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
@@ -18,7 +18,7 @@
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
- * CDDL HEADER END
+ * CDDL HEADER END
*
* Copyright 2008-2010 Very Old copyright owner Inc.
* Portions Copyright 2011-2012 Old copyright owner Inc.
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
index 2a1a77a..e01ee4e 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2011-2014 ForgeRock AS. All rights reserved.
*
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
index 3ebce6b..5f5a515 100644
--- 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
@@ -1,5 +1,5 @@
/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2010-2011 Old Copyright Owner.
*
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
index 6b4f8e5..e05d576 100644
--- 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
@@ -3,7 +3,7 @@
*
* Copyright (c) 2010-2011 Very Old Copyright Owner.
* Portions Copyrighted 2012-2013 Old Copyright Owner.
- * Portions Copyrighted 2013-2014 ForgeRock AS. All rights reserved.
+ * 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
@@ -24,5 +24,5 @@
* "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
+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 45d9d12..13f8f4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -502,7 +502,7 @@
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
- <id>check-copyrights</id>
+ <id>check-copyright</id>
<goals>
<goal>check-copyright</goal>
</goals>
@@ -512,5 +512,33 @@
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>copyrights-update</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-copyright</id>
+ <phase>none</phase>
+ <goals>
+ <goal>check-copyright</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>update-copyright</id>
+ <goals>
+ <goal>update-copyright</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
--
Gitblit v1.10.0