Added checkstyle to the default build lifecycle

- enabled just compliant rules including forbidding trailing spaces
- added module to have shared configuration for QA tools
  - the module uses aggregator as a parent, the reason is that nucleus-parent
    uses the module, so we have to avoid dependency cycle, but we still want
    to build the module in the same build execution
  - because of that I reenabled install plugin in aggregator, so now it is
    possible to use also -pl and other partial build configurations.
diff --git a/.gitignore b/.gitignore
index 2620da1..84f8810 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 nbactions.xml
 nb-configuration.xml
 .classpath
+.checkstyle
 .DS_Store
 .project
 .settings/
diff --git a/nucleus/parent/pom.xml b/nucleus/parent/pom.xml
index 403e785..eb84217 100644
--- a/nucleus/parent/pom.xml
+++ b/nucleus/parent/pom.xml
@@ -701,6 +701,49 @@
                     </configuration>
                 </plugin>
                 <plugin>
+                    <artifactId>maven-checkstyle-plugin</artifactId>
+                    <version>3.1.2</version>
+                    <configuration>
+                        <configLocation>org/glassfish/qa/config/checkstyle/checkstyle.xml</configLocation>
+                        <suppressionsLocation>org/glassfish/qa/config/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
+                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                        <skip>${checkstyle.skip}</skip>
+                        <logViolationsToConsole>true</logViolationsToConsole>
+                        <excludes>**/generated-sources/**/*</excludes>
+                        <!-- build-helper-plugin adds root as a resource path, but checkstyle doesn't use the filter and adds everything -->
+                        <resourceExcludes>
+                        **/appserver/**/target/**/*,
+                        **/appserver/**/src/main/resources/**/*,
+                        **/deployment/**/src/main/resources/**/*,
+                        **/target/classes/**/*,
+                        **/target/test-classes/**/*
+                        </resourceExcludes>
+                    </configuration>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.glassfish.main</groupId>
+                            <artifactId>glassfish-qa-config</artifactId>
+                            <version>${project.version}</version>
+                            <scope>runtime</scope>
+                        </dependency>
+                        <dependency>
+                            <groupId>com.puppycrawl.tools</groupId>
+                            <artifactId>checkstyle</artifactId>
+                            <version>8.42</version>
+                        </dependency>
+                    </dependencies>
+                    <executions>
+                        <execution>
+                            <id>${project.groupId}-${project.artifactId}-checkstyle</id>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                            <!-- why: tests first, quality requirements later -->
+                            <phase>verify</phase>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-release-plugin</artifactId>
                     <version>3.0.0-M1</version>
@@ -1067,6 +1110,10 @@
             </plugin>
 
             <plugin>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <inherited>true</inherited>
+            </plugin>
+            <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>findbugs-maven-plugin</artifactId>
                 <version>${findbugs.version}</version>
diff --git a/pom.xml b/pom.xml
index 27e2cbc..880ad6c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,7 @@
                 </property>
             </activation>
             <modules>
+                <module>qa</module>
                 <module>nucleus</module>
                 <module>appserver</module>
             </modules>
@@ -68,6 +69,7 @@
                 </property>
             </activation>
             <modules>
+                <module>qa</module>
                 <module>nucleus</module>
                 <module>appserver</module>
             </modules>
@@ -109,14 +111,6 @@
             <plugins>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-install-plugin</artifactId>
-                    <version>2.4</version>
-                    <configuration>
-                        <skip>true</skip>
-                    </configuration>
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-deploy-plugin</artifactId>
                     <version>2.7</version>
                     <configuration>
diff --git a/qa/pom.xml b/qa/pom.xml
new file mode 100644
index 0000000..d6db7b6
--- /dev/null
+++ b/qa/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.glassfish.main</groupId>
+        <artifactId>glassfish-main-aggregator</artifactId>
+        <version>6.1.1-SNAPSHOT</version>
+    </parent>
+    <artifactId>glassfish-qa-config</artifactId>
+    <name>Code Quality Verification Tools - Configuration</name>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>default-compile</id>
+                            <phase>none</phase>
+                        </execution>
+                        <execution>
+                            <id>default-testCompile</id>
+                            <phase>none</phase>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>default-test</id>
+                            <phase>none</phase>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>default-testResources</id>
+                            <phase>none</phase>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+</project>
diff --git a/qa/src/main/resources/org/glassfish/qa/config/checkstyle/checkstyle-suppressions.xml b/qa/src/main/resources/org/glassfish/qa/config/checkstyle/checkstyle-suppressions.xml
new file mode 100644
index 0000000..0ab5843
--- /dev/null
+++ b/qa/src/main/resources/org/glassfish/qa/config/checkstyle/checkstyle-suppressions.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE suppressions PUBLIC
+  "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
+  "https://checkstyle.org/dtds/suppressions_1_2.dtd">
+
+<suppressions>
+    <!-- Generated sources break some rules and are usually out of our control -->
+    <suppress checks=".*" files=".*[\\/]generated-sources[\\/].*" />
+    <suppress checks=".*" files="target[\\/]jackson-jaxb-src[\\/].*" />
+</suppressions>
diff --git a/qa/src/main/resources/org/glassfish/qa/config/checkstyle/checkstyle.xml b/qa/src/main/resources/org/glassfish/qa/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000..a319664
--- /dev/null
+++ b/qa/src/main/resources/org/glassfish/qa/config/checkstyle/checkstyle.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+      "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+      "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+    Checkstyle configuration that checks the sun coding conventions from:
+    - the Java Language Specification at http://java.sun.com/docs/books/jls/second_edition/html/index.html
+    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
+    - the Javadoc guidelines at http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
+    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
+    - some best practices
+
+    Checkstyle is very configurable. Be sure to read the documentation at
+    http://checkstyle.sf.net (or in your downloaded distribution).
+    Most Checks are configurable, be sure to consult the documentation.
+    To completely disable a check, just comment it out or delete it from the file.
+
+    Finally, it is worth reading the documentation.
+-->
+
+<module name="Checker">
+    <!-- Checks that each Java package has a Javadoc file used for commenting. -->
+    <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
+    <module name="JavadocPackage">
+        <property name="allowLegacy" value="true" />
+        <property name="severity" value="info" />
+    </module>
+
+    <!-- Checks that property files contain the same keys. -->
+    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
+    <module name="Translation" />
+
+    <!-- Checks for Size Violations. -->
+    <!-- See http://checkstyle.sf.net/config_sizes.html -->
+    <module name="FileLength">
+        <property name="max" value="2000" />
+        <property name="severity" value="warning" />
+    </module>
+
+    <module name="FileTabCharacter">
+        <property name="eachLine" value="true" />
+        <property name="fileExtensions"
+            value="java,jsp,jsf,css,html,htm,c,h,properties,txt,sh,sql" />
+        <property name="severity" value="error" />
+    </module>
+
+    <module name="RegexpSingleline">
+        <!-- \s matches whitespace character, $ matches end of line. -->
+        <property name="format" value="\s+$" />
+        <property name="message" value="Line has trailing spaces." />
+        <property name="severity" value="error" />
+    </module>
+
+    <module name="TreeWalker">
+
+        <property name="tabWidth" value="4" />
+
+        <!-- Checks for Javadoc comments. -->
+        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
+        <module name="JavadocMethod">
+            <property name="validateThrows" value="true" />
+            <property name="severity" value="warning" />
+            <property name="accessModifiers" value="public, protected" />
+        </module>
+        <module name="JavadocStyle">
+            <property name="checkFirstSentence" value="false" />
+            <property name="severity" value="warning" />
+        </module>
+        <module name="JavadocType">
+            <property name="severity" value="warning" />
+        </module>
+        <module name="JavadocVariable">
+            <property name="scope" value="protected" />
+            <property name="severity" value="warning" />
+        </module>
+
+        <!-- Checks for Naming Conventions. -->
+        <module name="ClassTypeParameterName" />
+        <module name="PackageName" />
+
+        <!-- Checks for imports                              -->
+        <!-- See http://checkstyle.sf.net/config_import.html -->
+        <module name="IllegalImport" /> <!-- defaults to sun.* packages -->
+
+        <!-- Modifier Checks                                    -->
+        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
+        <module name="RedundantModifier">
+            <property name="severity" value="info" />
+        </module>
+
+        <!-- Checks for common coding problems               -->
+        <!-- See http://checkstyle.sf.net/config_coding.html -->
+        <module name="ArrayTrailingComma">
+            <property name="severity" value="warning"/>
+        </module>
+        <module name="ExplicitInitialization">
+            <property name="severity" value="info" />
+        </module>
+        <module name="IllegalInstantiation" />
+        <module name="MagicNumber">
+            <property name="severity" value="info" />
+        </module>
+        <module name="MissingSwitchDefault">
+            <property name="severity" value="warning" />
+        </module>
+        <module name="MultipleStringLiterals">
+            <property name="allowedDuplicates" value="1" />
+            <property name="ignoreStringsRegexp" value="^((&quot;(([^=]+=)|([^\)]*\))|([\s\)\('&quot;,.\+\-\:]+))&quot;))$" />
+            <property name="severity" value="warning" />
+        </module>
+        <module name="PackageDeclaration" />
+
+        <!-- See http://checkstyle.sourceforge.net/config_metrics.html -->
+        <module name="ClassDataAbstractionCoupling">
+            <property name="max" value="16" />
+            <property name="severity" value="warning" />
+        </module>
+        <module name="CyclomaticComplexity">
+            <property name="max" value="50" />
+            <property name="severity" value="warning" />
+        </module>
+        <module name="JavaNCSS">
+            <property name="methodMaximum" value="100" />
+            <property name="classMaximum" value="20000" />
+            <property name="severity" value="warning" />
+        </module>
+
+        <!-- Miscellaneous other checks. -->
+        <!-- See http://checkstyle.sf.net/config_misc.html -->
+        <module name="Indentation">
+            <property name="basicOffset" value="4" />
+            <property name="braceAdjustment" value="0" />
+            <property name="caseIndent" value="4" />
+            <property name="severity" value="warning" />
+        </module>
+        <module name="TodoComment">
+            <property name="format" value="TODO|FIXME|[VW]OODOO|WTF" />
+            <property name="severity" value="warning" />
+        </module>
+        <module name="TrailingComment">
+            <property name="severity" value="warning" />
+        </module>
+    </module>
+
+</module>