Fix sonar and checkstyle issues in distribution

* Fixing all check style issues.
* Fixing all sonar issues.
* Adding maven check style plugin to fail at warning level.

Change-Id: I791b8feef39a3a0c3e1e250efea7b6e78208bf07
Issue-ID: POLICY-1035
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
diff --git a/pom.xml b/pom.xml
index 3301082..c05b6dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,11 +39,13 @@
 
     <properties>
         <!-- sonar/jacoco overrides -->
-        <!-- Overriding oparent default sonar/jacoco settings Combine all our reports 
+        <!-- Overriding oparent default sonar/jacoco settings Combine all our reports
             into one file shared across sub-modules -->
         <sonar.jacoco.reportPath>${project.basedir}/../target/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
         <sonar.jacoco.itReportPath>${project.basedir}/../target/code-coverage/jacoco-it.exec</sonar.jacoco.itReportPath>
         <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
+
+        <policy.common.version>1.3.0-SNAPSHOT</policy.common.version>
     </properties>
 
     <modules>
@@ -114,6 +116,42 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>onap-java-style</id>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <phase>process-sources</phase>
+                        <configuration>
+                            <!-- Use Google Java Style Guide:
+                            https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml
+                            with minor changes -->
+                            <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+                            <!-- <sourceDirectory> is needed so that checkstyle ignores the generated sources directory -->
+                            <sourceDirectory>${project.build.sourceDirectory}/src/main/java</sourceDirectory>
+                            <includeResources>true</includeResources>
+                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                            <includeTestResources>true</includeTestResources>
+                            <excludes>
+                            </excludes>
+                            <consoleOutput>true</consoleOutput>
+                            <failOnViolation>true</failOnViolation>
+                            <violationSeverity>warning</violationSeverity>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.onap.oparent</groupId>
+                        <artifactId>checkstyle</artifactId>
+                        <version>1.1.0</version>
+                        <scope>compile</scope>
+                    </dependency>
+                </dependencies>
+            </plugin>
         </plugins>
         <pluginManagement>
             <plugins>