From 17c75eab3d7c75afab1476bf8f021e7debe20641 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Thu, 05 Feb 2015 15:03:03 +0000
Subject: [PATCH] fix checkstyle issues for new maven plugins

---
 opendj-manifest-classpath-maven-plugin/src/main/java/org/forgerock/maven/GenerateManifestClassPathMojo.java |   29 ++-
 opendj-concat-schema-maven-plugin/src/main/java/org/forgerock/maven/ConcatSchemaMojo.java                   |  299 ++++++++++++++++++------------------------
 opendj-logref-doc-maven-plugin/src/main/java/org/forgerock/maven/GenerateMessageFileMojo.java               |   68 +++++----
 3 files changed, 182 insertions(+), 214 deletions(-)

diff --git a/opendj-concat-schema-maven-plugin/src/main/java/org/forgerock/maven/ConcatSchemaMojo.java b/opendj-concat-schema-maven-plugin/src/main/java/org/forgerock/maven/ConcatSchemaMojo.java
index 405c9cf..21ed0f4 100644
--- a/opendj-concat-schema-maven-plugin/src/main/java/org/forgerock/maven/ConcatSchemaMojo.java
+++ b/opendj-concat-schema-maven-plugin/src/main/java/org/forgerock/maven/ConcatSchemaMojo.java
@@ -43,216 +43,173 @@
 import org.apache.maven.project.MavenProject;
 
 /**
- * Concatenates the contents of the files in the schema directory to create a
- * base schema that may be used during the upgrade process. Each element will
- * also include the X-SCHEMA-FILE extension to indicate the source schema file.
+ * Concatenates the contents of the files in the schema directory to create a base schema that may be used during the
+ * upgrade process. Each element will also include the X-SCHEMA-FILE extension to indicate the source schema file.
  * <p>
  * There is a single goal that generates the base schema.
  * <p>
  *
  * @Checkstyle:ignoreFor 3
  */
-@Mojo(name="concat", defaultPhase=LifecyclePhase.GENERATE_SOURCES)
+@Mojo(name = "concat", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
 public final class ConcatSchemaMojo extends AbstractMojo {
 
     /**
      * The Maven Project.
      */
-    @Parameter(property="project", required=true, readonly=true)
+    @Parameter(property = "project", required = true, readonly = true)
     private MavenProject project;
 
     /**
      * The path to the directory containing the schema files.
      */
-    @Parameter(required=true, defaultValue="${basedir}/resource/schema")
+    @Parameter(required = true, defaultValue = "${basedir}/resource/schema")
     private String schemaDirectory;
 
     /**
-     * The directory path of the concatenated schema file to create.
-     * Must be in ${project.build.directory}
+     * The directory path of the concatenated schema file to create. Must be in ${project.build.directory}
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private String outputDirectory;
 
     /**
      * The file name of the concatenated schema file to create.
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private String outputFile;
 
-
     /** {@inheritDoc} */
-    public void execute() throws MojoExecutionException, MojoFailureException
-    {
-      String projectBuildDir = project.getBuild().getDirectory();
-      String outputFilePath = outputDirectory + System.getProperty("file.separator") + outputFile;
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        String projectBuildDir = project.getBuild().getDirectory();
+        String outputFilePath = outputDirectory + System.getProperty("file.separator") + outputFile;
 
-      if (!outputDirectory.contains(projectBuildDir))
-      {
-        String errorMsg = String.format("outputDirectory parameter (%s) must be included "
-            + "in ${project.build.directory} (%s)", outputDirectory, projectBuildDir);
-        getLog().error(errorMsg);
-        throw new MojoExecutionException(errorMsg);
-      }
-      getLog().info(String.format("Concatenating all ldif files from directory: %s", schemaDirectory));
-      getLog().info(String.format("Concatenated file: %s", outputFilePath));
-
-      new File(outputFilePath).getParentFile().mkdirs();
-
-      // Get a sorted list of the files in the schema directory.
-      TreeSet<String> schemaFileNames = new TreeSet<String>();
-      for (File f : new File(schemaDirectory).listFiles())
-      {
-        if (f.isFile())
-        {
-          schemaFileNames.add(f.getName());
+        if (!outputDirectory.contains(projectBuildDir)) {
+            String errorMsg = String.format("outputDirectory parameter (%s) must be included "
+                    + "in ${project.build.directory} (%s)", outputDirectory, projectBuildDir);
+            getLog().error(errorMsg);
+            throw new MojoExecutionException(errorMsg);
         }
-      }
+        getLog().info(String.format("Concatenating all ldif files from directory: %s", schemaDirectory));
+        getLog().info(String.format("Concatenated file: %s", outputFilePath));
 
+        new File(outputFilePath).getParentFile().mkdirs();
 
-      // Create a set of lists that will hold the schema elements read from the
-      // files.
-      LinkedList<String> attributeTypes    = new LinkedList<String>();
-      LinkedList<String> objectClasses     = new LinkedList<String>();
-      LinkedList<String> nameForms         = new LinkedList<String>();
-      LinkedList<String> ditContentRules   = new LinkedList<String>();
-      LinkedList<String> ditStructureRules = new LinkedList<String>();
-      LinkedList<String> matchingRuleUses  = new LinkedList<String>();
-      LinkedList<String> ldapSyntaxes      = new LinkedList<String>();
-      int curLineNumber = 0;
-
-      // Open each of the files in order and read the elements that they contain,
-      // appending them to the appropriate lists.
-      for (String name : schemaFileNames)
-      {
-        // Read the contents of the file into a list with one schema element per
-        // list element.
-        LinkedList<StringBuilder> lines = new LinkedList<StringBuilder>();
-        try
-        {
-          BufferedReader reader = new BufferedReader(new FileReader(
-                                           new File(schemaDirectory, name)));
-          String line = reader.readLine();
-          while (line != null)
-          {
-            curLineNumber++;
-            if (line.length() > 0 && !line.startsWith("#"))
-            {
-              if (line.startsWith(" "))
-              {
-                lines.getLast().append(line.substring(1));
-              }
-              else
-              {
-                lines.add(new StringBuilder(line));
-              }
+        // Get a sorted list of the files in the schema directory.
+        TreeSet<String> schemaFileNames = new TreeSet<String>();
+        for (File f : new File(schemaDirectory).listFiles()) {
+            if (f.isFile()) {
+                schemaFileNames.add(f.getName());
             }
-            line = reader.readLine();
-          }
-          reader.close();
         }
-        catch (Exception e)
-        {
-            getLog().error(String.format(
-                "Error while reading schema file %s at line %d: %s", name, curLineNumber, e.getMessage()));
+
+        // Create a set of lists that will hold the schema elements read from the
+        // files.
+        LinkedList<String> attributeTypes = new LinkedList<String>();
+        LinkedList<String> objectClasses = new LinkedList<String>();
+        LinkedList<String> nameForms = new LinkedList<String>();
+        LinkedList<String> ditContentRules = new LinkedList<String>();
+        LinkedList<String> ditStructureRules = new LinkedList<String>();
+        LinkedList<String> matchingRuleUses = new LinkedList<String>();
+        LinkedList<String> ldapSyntaxes = new LinkedList<String>();
+        int curLineNumber = 0;
+
+        // Open each of the files in order and read the elements that they contain,
+        // appending them to the appropriate lists.
+        for (String name : schemaFileNames) {
+            // Read the contents of the file into a list with one schema element per
+            // list element.
+            LinkedList<StringBuilder> lines = new LinkedList<StringBuilder>();
+            try {
+                BufferedReader reader = new BufferedReader(new FileReader(new File(schemaDirectory, name)));
+                String line = reader.readLine();
+                while (line != null) {
+                    curLineNumber++;
+                    if (line.length() > 0 && !line.startsWith("#")) {
+                        if (line.startsWith(" ")) {
+                            lines.getLast().append(line.substring(1));
+                        } else {
+                            lines.add(new StringBuilder(line));
+                        }
+                    }
+                    line = reader.readLine();
+                }
+                reader.close();
+            } catch (Exception e) {
+                getLog().error(
+                        String.format("Error while reading schema file %s at line %d: %s", name, curLineNumber,
+                                e.getMessage()));
+                throw new MojoExecutionException(e.getMessage());
+            }
+
+            // Iterate through each line in the list. Find the colon and get the
+            // attribute name at the beginning. If it's someting that we don't
+            // recognize, then skip it. Otherwise, add the X-SCHEMA-FILE extension
+            // and add it to the appropriate schema element list.
+            for (StringBuilder buffer : lines) {
+                // Get the line and add the X-SCHEMA-FILE extension to the end of it.
+                // All of them should end with " )" but some might have the parenthesis
+                // crammed up against the last character so deal with that as well.
+                String line = buffer.toString().trim();
+                if (line.endsWith(" )")) {
+                    line = line.substring(0, line.length() - 1) + "X-SCHEMA-FILE '" + name + "' )";
+                } else if (line.endsWith(")")) {
+                    line = line.substring(0, line.length() - 1) + " X-SCHEMA-FILE '" + name + "' )";
+                } else {
+                    continue;
+                }
+
+                String lowerLine = line.toLowerCase();
+                if (lowerLine.startsWith("attributetypes:")) {
+                    attributeTypes.add(line);
+                } else if (lowerLine.startsWith("objectclasses:")) {
+                    objectClasses.add(line);
+                } else if (lowerLine.startsWith("nameforms:")) {
+                    nameForms.add(line);
+                } else if (lowerLine.startsWith("ditcontentrules:")) {
+                    ditContentRules.add(line);
+                } else if (lowerLine.startsWith("ditstructurerules:")) {
+                    ditStructureRules.add(line);
+                } else if (lowerLine.startsWith("matchingruleuse:")) {
+                    matchingRuleUses.add(line);
+                } else if (lowerLine.startsWith("ldapsyntaxes:")) {
+                    ldapSyntaxes.add(line);
+                }
+            }
+        }
+
+        // Write the resulting output to the merged schema file.
+        try {
+            BufferedWriter writer = new BufferedWriter(new FileWriter(outputFilePath));
+            writer.write("dn: cn=schema");
+            writer.newLine();
+            writer.write("objectClass: top");
+            writer.newLine();
+            writer.write("objectClass: ldapSubentry");
+            writer.newLine();
+            writer.write("objectClass: subschema");
+            writer.newLine();
+
+            writeSchemaElements(ldapSyntaxes, writer);
+            writeSchemaElements(attributeTypes, writer);
+            writeSchemaElements(objectClasses, writer);
+            writeSchemaElements(nameForms, writer);
+            writeSchemaElements(ditContentRules, writer);
+            writeSchemaElements(ditStructureRules, writer);
+            writeSchemaElements(matchingRuleUses, writer);
+
+            writer.close();
+        } catch (Exception e) {
+            getLog().error(
+                    String.format("Error while writing concatenated schema file %s:  %s", outputFile, e.getMessage()));
             throw new MojoExecutionException(e.getMessage());
         }
-
-
-        // Iterate through each line in the list.  Find the colon and get the
-        // attribute name at the beginning.  If it's someting that we don't
-        // recognize, then skip it.  Otherwise, add the X-SCHEMA-FILE extension
-        // and add it to the appropriate schema element list.
-        for (StringBuilder buffer : lines)
-        {
-          // Get the line and add the X-SCHEMA-FILE extension to the end of it.
-          // All of them should end with " )" but some might have the parenthesis
-          // crammed up against the last character so deal with that as well.
-          String line = buffer.toString().trim();
-          if (line.endsWith(" )"))
-          {
-           line = line.substring(0, line.length() - 1) + "X-SCHEMA-FILE '" + name + "' )";
-          }
-          else if (line.endsWith(")"))
-          {
-           line = line.substring(0, line.length() - 1) + " X-SCHEMA-FILE '" + name + "' )";
-          }
-          else
-          {
-            continue;
-          }
-
-          String lowerLine = line.toLowerCase();
-          if (lowerLine.startsWith("attributetypes:"))
-          {
-            attributeTypes.add(line);
-          }
-          else if (lowerLine.startsWith("objectclasses:"))
-          {
-            objectClasses.add(line);
-          }
-          else if (lowerLine.startsWith("nameforms:"))
-          {
-            nameForms.add(line);
-          }
-          else if (lowerLine.startsWith("ditcontentrules:"))
-          {
-            ditContentRules.add(line);
-          }
-          else if (lowerLine.startsWith("ditstructurerules:"))
-          {
-            ditStructureRules.add(line);
-          }
-          else if (lowerLine.startsWith("matchingruleuse:"))
-          {
-            matchingRuleUses.add(line);
-          }
-          else if (lowerLine.startsWith("ldapsyntaxes:"))
-          {
-            ldapSyntaxes.add(line);
-          }
-        }
-      }
-
-
-      // Write the resulting output to the merged schema file.
-      try
-      {
-        BufferedWriter writer = new BufferedWriter(new FileWriter(outputFilePath));
-        writer.write("dn: cn=schema");
-        writer.newLine();
-        writer.write("objectClass: top");
-        writer.newLine();
-        writer.write("objectClass: ldapSubentry");
-        writer.newLine();
-        writer.write("objectClass: subschema");
-        writer.newLine();
-
-        writeSchemaElements(ldapSyntaxes, writer);
-        writeSchemaElements(attributeTypes, writer);
-        writeSchemaElements(objectClasses, writer);
-        writeSchemaElements(nameForms, writer);
-        writeSchemaElements(ditContentRules, writer);
-        writeSchemaElements(ditStructureRules, writer);
-        writeSchemaElements(matchingRuleUses, writer);
-
-        writer.close();
-      }
-      catch (Exception e)
-      {
-        getLog().error(String.format(
-            "Error while writing concatenated schema file %s:  %s", outputFile, e.getMessage()));
-        throw new MojoExecutionException(e.getMessage());
-      }
     }
 
-
-
     private void writeSchemaElements(LinkedList<String> schemaElements, BufferedWriter writer) throws IOException {
-        for (String line : schemaElements)
-        {
-          writer.write(line);
-          writer.newLine();
+        for (String line : schemaElements) {
+            writer.write(line);
+            writer.newLine();
         }
     }
 
diff --git a/opendj-logref-doc-maven-plugin/src/main/java/org/forgerock/maven/GenerateMessageFileMojo.java b/opendj-logref-doc-maven-plugin/src/main/java/org/forgerock/maven/GenerateMessageFileMojo.java
index 9230749..69b6267 100644
--- a/opendj-logref-doc-maven-plugin/src/main/java/org/forgerock/maven/GenerateMessageFileMojo.java
+++ b/opendj-logref-doc-maven-plugin/src/main/java/org/forgerock/maven/GenerateMessageFileMojo.java
@@ -54,50 +54,51 @@
 import org.forgerock.util.Utils;
 
 /**
- * Generates xml files containing representations of messages found in properties files.
+ * Generates xml files containing representations of messages found in
+ * properties files.
  * <p>
  * There is a single goal that generates xml files.
  * <p>
  */
-@Mojo(defaultPhase=LifecyclePhase.PRE_SITE, name="generate-xml-messages-doc")
+@Mojo(defaultPhase = LifecyclePhase.PRE_SITE, name = "generate-xml-messages-doc")
 public class GenerateMessageFileMojo extends AbstractMojo {
 
     /**
      * The Maven Project.
      */
-    @Parameter(property="project", readonly=true, required=true)
+    @Parameter(property = "project", readonly = true, required = true)
     private MavenProject project;
 
     /**
      * The path to the directory containing the message properties files.
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private String messagesDirectory;
 
     /**
      * The path to the directory where xml reference files should be written.
      * This path must be relative to ${project.build.directory}.
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private String outputDirectory;
 
     /**
      * A list which contains all file names, the extension is not needed.
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private List<String> messageFileNames;
 
     /**
-     * The path and file name of the log message reference file path which will be copied in
-     * the output directory with generated log reference files.
+     * The path and file name of the log message reference file path which will
+     * be copied in the output directory with generated log reference files.
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private String logMessageReferenceFilePath;
 
     /**
      * If the plugin is supposed to overwrite existing generated xml files.
      */
-    @Parameter(required=true, defaultValue="false")
+    @Parameter(required = true, defaultValue = "false")
     private boolean overwrite;
 
     /** The end-of-line character for this platform. */
@@ -108,15 +109,14 @@
      * of where the source are generated, the package name and the
      * DESCRIPTORS_REG value.
      */
-    private static String REGISTRY_FILE_NAME;
+    private static String registryFileName;
 
     /**
      * One-line descriptions for log reference categories.
      */
-    private static HashMap<String, String> CATEGORY_DESCRIPTIONS;
+    private static final HashMap<String, String> CATEGORY_DESCRIPTIONS = new HashMap<String, String>();
 
     static {
-        CATEGORY_DESCRIPTIONS = new HashMap<String, String>();
         CATEGORY_DESCRIPTIONS.put("ACCESS_CONTROL", "Access Control.");
         CATEGORY_DESCRIPTIONS.put("ADMIN", "the administration framework.");
         CATEGORY_DESCRIPTIONS.put("ADMIN_TOOL", "the tool like the offline" + " installer and uninstaller.");
@@ -146,7 +146,7 @@
     private static final String DESCRIPTORS_REG = "descriptors.reg";
 
     /** Message giving formatting rules for string keys. */
-    public static String KEY_FORM_MSG = ".\n\nOpenDJ message property keys must be of the form\n\n"
+    public static final String KEY_FORM_MSG = ".\n\nOpenDJ message property keys must be of the form\n\n"
             + "\t\'[CATEGORY]_[SEVERITY]_[DESCRIPTION]_[ORDINAL]\'\n\n";
 
     private static final String ERROR_SEVERITY_IDENTIFIER_STRING = "ERR_";
@@ -220,6 +220,7 @@
          *
          * @return See {@link java.lang.Comparable#compareTo(Object)}.
          */
+        @Override
         public int compareTo(MessageRefEntry mre) {
             if (this.ordinal == null || mre.ordinal == null) {
                 return 0;
@@ -293,8 +294,8 @@
         private String getVariablelistHead() {
             StringBuilder builder = new StringBuilder(getXMLPreamble());
             builder.append(" <variablelist xml:id=\"log-ref-").append(this.category).append("\" ")
-                   .append(getBaseElementAttrs()).append(">").append(EOL)
-                   .append("  <title>Log Message Category: ").append(category).append("</title>").append(EOL);
+                    .append(getBaseElementAttrs()).append(">").append(EOL).append("  <title>Log Message Category: ")
+                    .append(category).append("</title>").append(EOL);
 
             return builder.toString();
         }
@@ -359,6 +360,7 @@
         }
 
         /** {@inheritDoc} */
+        @Override
         public String toString() {
             StringBuilder builder = new StringBuilder(description);
             if (ordinal != null) {
@@ -369,6 +371,7 @@
         }
 
         /** {@inheritDoc} */
+        @Override
         public int compareTo(MessagePropertyKey k) {
             if (ordinal == k.ordinal) {
                 return description.compareTo(k.description);
@@ -383,16 +386,20 @@
      * For maven exec plugin execution. Generates for all included message files
      * (sample.properties), a xml log ref file (log-ref-sample.xml)
      *
-     * @throws Exception
+     * @throws MojoExecutionException
+     *          if a problem occurs
+     * @throws MojoFailureException
+     *          if a problem occurs
      */
+    @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         String projectBuildDir = project.getBuild().getDirectory();
 
         if (!outputDirectory.contains(projectBuildDir)) {
-          String errorMsg = String.format("outputDirectory parameter (%s) must be included "
-              + "in ${project.build.directory} (%s)", outputDirectory, projectBuildDir);
-          getLog().error(errorMsg);
-          throw new MojoExecutionException(errorMsg);
+            String errorMsg = String.format("outputDirectory parameter (%s) must be included "
+                    + "in ${project.build.directory} (%s)", outputDirectory, projectBuildDir);
+            getLog().error(errorMsg);
+            throw new MojoExecutionException(errorMsg);
         }
 
         for (String messageFileName : messageFileNames) {
@@ -408,8 +415,8 @@
         copyLogMessageReferenceFile();
     }
 
-
-    private void generateLogReferenceFile(File source, File dest, String globalCategory) throws MojoExecutionException {
+    private void generateLogReferenceFile(File source, File dest, String globalCategory)
+            throws MojoExecutionException {
         PrintWriter destWriter = null;
         try {
             // Decide whether to generate messages based on modification times
@@ -439,9 +446,8 @@
                 messageRefEntries.add(new MessageRefEntry(msgKey.toString(), msgKey.getOrdinal(), formatString));
             }
 
-            destWriter.println(messageRefEntries.isEmpty() ?
-                            "<!-- No message for this category -->"
-                          : new MessageRefCategory(globalCategory, messageRefEntries).toXML());
+            destWriter.println(messageRefEntries.isEmpty() ? "<!-- No message for this category -->"
+                    : new MessageRefCategory(globalCategory, messageRefEntries).toXML());
             getLog().info(dest.getPath() + " has been successfully generated");
             getLog().debug("Message Generated: " + errorMessages.size());
         } catch (Exception e) {
@@ -455,7 +461,6 @@
         }
     }
 
-
     private Map<MessagePropertyKey, String> loadErrorProperties(Properties properties) throws Exception {
         Map<MessagePropertyKey, String> errorMessage = new TreeMap<MessagePropertyKey, String>();
         for (Object propO : properties.keySet()) {
@@ -475,7 +480,6 @@
         return errorMessage;
     }
 
-
     private boolean isOverwriteNeeded(File source, File dest) {
         boolean needsOverwrite = this.overwrite || source.lastModified() > dest.lastModified();
         if (dest.exists() && needsOverwrite) {
@@ -526,14 +530,16 @@
      *
      * @param dest
      *            File destination
+     * @throws Exception
+     *          If a problem occurs
      */
     public void checkDestJava(File dest) throws Exception {
         File descriptorsRegFile = new File(dest.getParentFile(), DESCRIPTORS_REG);
 
-        if (REGISTRY_FILE_NAME != null) {
+        if (registryFileName != null) {
             // if REGISTRY_FILE_NAME is already set, ensure that we computed the
             // same one
-            File prevDescriptorsRegFile = new File(REGISTRY_FILE_NAME);
+            File prevDescriptorsRegFile = new File(registryFileName);
             if (!prevDescriptorsRegFile.equals(descriptorsRegFile)) {
                 throw new Exception("Error processing " + dest
                         + ": all messages must be located in the same package thus "
@@ -541,7 +547,7 @@
                         + new File(prevDescriptorsRegFile.getParent(), dest.getName()));
             }
         } else {
-            REGISTRY_FILE_NAME = descriptorsRegFile.getCanonicalPath();
+            registryFileName = descriptorsRegFile.getCanonicalPath();
         }
     }
 
diff --git a/opendj-manifest-classpath-maven-plugin/src/main/java/org/forgerock/maven/GenerateManifestClassPathMojo.java b/opendj-manifest-classpath-maven-plugin/src/main/java/org/forgerock/maven/GenerateManifestClassPathMojo.java
index e3297c5..4ecf810 100644
--- a/opendj-manifest-classpath-maven-plugin/src/main/java/org/forgerock/maven/GenerateManifestClassPathMojo.java
+++ b/opendj-manifest-classpath-maven-plugin/src/main/java/org/forgerock/maven/GenerateManifestClassPathMojo.java
@@ -25,6 +25,8 @@
  */
 package org.forgerock.maven;
 
+import static java.lang.String.*;
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -43,15 +45,16 @@
 import org.apache.maven.project.MavenProject;
 
 /**
- * Generate a class path suitable for the Class-Path header of a Manifest file, allowing to filter
- * on included jars, using excludes/includes properties.
+ * Generate a class path suitable for the Class-Path header of a Manifest file, allowing to filter on included jars,
+ * using excludes/includes properties.
  * <p>
- * There is a single goal that generates a property given by 'classPathProperty' parameter, with the generated
- * classpath as the value.
+ * There is a single goal that generates a property given by 'classPathProperty' parameter, with the generated classpath
+ * as the value.
  *
  * @Checkstyle:ignoreFor 3
  */
-@Mojo(name="generate", defaultPhase=LifecyclePhase.VALIDATE, requiresDependencyResolution=ResolutionScope.COMPILE_PLUS_RUNTIME)
+@Mojo(name = "generate", defaultPhase = LifecyclePhase.VALIDATE,
+    requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
 public final class GenerateManifestClassPathMojo extends AbstractMojo {
 
     private static final int MAX_LINE_LENGTH = 72;
@@ -60,13 +63,13 @@
     /**
      * The Maven Project.
      */
-    @Parameter(property="project", required=true, readonly=true)
+    @Parameter(property = "project", required = true, readonly = true)
     private MavenProject project;
 
     /**
      * A property to set to the content of the generated classpath string.
      */
-    @Parameter(required=true)
+    @Parameter(required = true)
     private String classPathProperty;
 
     /**
@@ -82,13 +85,13 @@
     private List<String> includes;
 
     /**
-     * Name of product jar, e.g. "OpenDJ"
+     * Name of product jar, e.g. "OpenDJ".
      */
     @Parameter
     private String productJarName;
 
     /**
-     * List of supported locales, separated by a ","
+     * List of supported locales, separated by a ",".
      * <p>
      * Example: "fr,es,de"
      */
@@ -96,15 +99,17 @@
     private String supportedLocales;
 
     /** {@inheritDoc} */
+    @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         try {
             String classPath = getClasspath();
-            getLog().info(String.format("Setting the classpath property: [%s] (debug to see actual value)", classPathProperty));
+            getLog().info(
+                    format("Setting the classpath property: [%s] (debug to see actual value)", classPathProperty));
             getLog().debug(String.format("Setting the classpath property %s to:\n%s", classPathProperty, classPath));
             project.getProperties().put(classPathProperty, classPath);
         } catch (DependencyResolutionRequiredException e) {
             getLog().error(
-                String.format("Unable to set the classpath property %s, an error occured", classPathProperty));
+                    String.format("Unable to set the classpath property %s, an error occured", classPathProperty));
             throw new MojoFailureException(e.getMessage());
         }
     }
@@ -151,7 +156,7 @@
         if (productJarName != null) {
             if (supportedLocales != null) {
                 String[] locales = supportedLocales.split(",");
-                for (int i = locales.length-1; i >= 0; i--) {
+                for (int i = locales.length - 1; i >= 0; i--) {
                     classpathItems.add(0, productJarName + "_" + locales[i] + ".jar");
                 }
             }

--
Gitblit v1.10.0