diff --git a/ranger-examples/conditions-enrichers/pom.xml b/ranger-examples/conditions-enrichers/pom.xml
index 6be7a4829a..771b14a682 100644
--- a/ranger-examples/conditions-enrichers/pom.xml
+++ b/ranger-examples/conditions-enrichers/pom.xml
@@ -45,4 +45,18 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                    <failOnViolation>true</failOnViolation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/ranger-examples/dev-support/ranger-pmd-ruleset.xml b/ranger-examples/dev-support/ranger-pmd-ruleset.xml
deleted file mode 100644
index 9e5ed7a5db..0000000000
--- a/ranger-examples/dev-support/ranger-pmd-ruleset.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements. See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership. The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License. You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied. See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<ruleset name="ranger-pmd" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
-  <description>
-     Apache Ranger - PMD rule set
-  </description>
-
-  <rule ref="category/java/bestpractices.xml">
-	<!-- TODO: can be Handle -->
-	<exclude name="ForLoopCanBeForeach" />
-	<exclude name="UseCollectionIsEmpty" />
-	<exclude name="UnusedLocalVariable" />
-	<exclude name="UnusedPrivateField" />
-	<exclude name="WhileLoopWithLiteralBoolean" />
-	<exclude name="UnusedFormalParameter" />
-	<exclude name="ForLoopVariableCount" />
-	<exclude name="DoubleBraceInitialization" />
-	<exclude name="AbstractClassWithoutAbstractMethod" />
-	<exclude name="UseTryWithResources" />
-	<exclude name="GuardLogStatement" /> <!-- TODO: guard only debug log level-->
-	<!-- Nothing -->
-	<exclude name="AvoidReassigningParameters" />
-	<exclude name="MissingOverride" />
-	<exclude name="AvoidPrintStackTrace" />
-	<exclude name="SystemPrintln" />
-	<exclude name="UseVarargs" />
-	<exclude name="PositionLiteralsFirstInComparisons" />
-	<exclude name="JUnitAssertionsShouldIncludeMessage" />
-	<exclude name="UseAssertEqualsInsteadOfAssertTrue" />
-	<exclude name="AvoidUsingHardCodedIP" />
-	<exclude name="AccessorMethodGeneration" />
-	<exclude name="PositionLiteralsFirstInCaseInsensitiveComparisons" />
-	<exclude name="LooseCoupling" />
-	<exclude name="SwitchStmtsShouldHaveDefault" />
-	<exclude name="AvoidReassigningLoopVariables" />
-	<exclude name="JUnitTestContainsTooManyAsserts" />
-	<exclude name="JUnitTestsShouldIncludeAssert" />
-	<exclude name="UseAssertSameInsteadOfAssertTrue" />
-	<exclude name="UseAssertNullInsteadOfAssertTrue" />
-	<exclude name="UseAssertTrueInsteadOfAssertEquals" />
-	<exclude name="MethodReturnsInternalArray" />
-	<exclude name="PreserveStackTrace" />
-	<exclude name="OneDeclarationPerLine" />
-	<exclude name="ArrayIsStoredDirectly" />
-	<exclude name="AccessorClassGeneration" />
-	<exclude name="ConstantsInInterface" />
-  </rule>
-  <rule ref="category/java/codestyle.xml">
-	<!-- TODO: can be Handle -->
-	<exclude name="UnnecessaryLocalBeforeReturn" />
-	<exclude name="UnnecessaryModifier" />
-	<exclude name="UnnecessaryConstructor" />
-	<exclude name="UnnecessaryFullyQualifiedName" />
-	<exclude name="UnnecessaryAnnotationValueElement" />
-	<exclude name="LocalVariableNamingConventions" />
-	<exclude name="AvoidDollarSigns" />
-	<exclude name="ClassNamingConventions" />
-	<!-- Nothing -->
-	<exclude name="LocalVariableCouldBeFinal" />
-	<exclude name="MethodArgumentCouldBeFinal" />
-	<exclude name="ShortVariable" />
-	<exclude name="LongVariable" />
-	<exclude name="IdenticalCatchBranches" />
-	<exclude name="ControlStatementBraces" />
-	<exclude name="UselessParentheses" />
-	<exclude name="FieldNamingConventions" />
-	<exclude name="ConfusingTernary" />
-	<exclude name="OnlyOneReturn" />
-	<exclude name="AtLeastOneConstructor" />
-	<exclude name="PrematureDeclaration" />
-	<exclude name="CallSuperInConstructor" />
-	<exclude name="DefaultPackage" />
-	<exclude name="CommentDefaultAccessModifier" />
-	<exclude name="UseDiamondOperator" />
-	<exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
-	<exclude name="BooleanGetMethodName" />
-	<exclude name="EmptyMethodInAbstractClassShouldBeAbstract" />
-	<exclude name="UseUnderscoresInNumericLiterals" />
-	<exclude name="MethodNamingConventions" />
-	<exclude name="UseShortArrayInitializer" />
-	<exclude name="LinguisticNaming" />
-	<exclude name="ShortClassName" />
-	<exclude name="FormalParameterNamingConventions" />
-	<exclude name="ShortMethodName" />
-	<exclude name="PackageCase" />
-	<exclude name="GenericsNaming" />
-	<exclude name="TooManyStaticImports" />
-  </rule>
-  <rule ref="category/java/multithreading.xml">
-	<!-- TODO: can be Handle -->
-	<exclude name="DontCallThreadRun" />
-	<exclude name="DoubleCheckedLocking" />
-	<exclude name="AvoidSynchronizedAtMethodLevel" />
-	<exclude name="UseConcurrentHashMap" />
-	<exclude name="AvoidUsingVolatile" />
-	<!-- Nothing -->
-	<exclude name="DoNotUseThreads" />
-	<exclude name="UseNotifyAllInsteadOfNotify" />
-	<exclude name="NonThreadSafeSingleton" />
-  </rule>
-
-</ruleset>
diff --git a/ranger-examples/distro/pom.xml b/ranger-examples/distro/pom.xml
index eda1f4dae9..3da077af94 100644
--- a/ranger-examples/distro/pom.xml
+++ b/ranger-examples/distro/pom.xml
@@ -51,6 +51,20 @@
             <version>${project.version}</version>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                    <failOnViolation>true</failOnViolation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 
     <profiles>
         <profile>
diff --git a/ranger-examples/plugin-sampleapp/pom.xml b/ranger-examples/plugin-sampleapp/pom.xml
index 843b2a22e0..88370b8ce1 100644
--- a/ranger-examples/plugin-sampleapp/pom.xml
+++ b/ranger-examples/plugin-sampleapp/pom.xml
@@ -134,4 +134,18 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                    <failOnViolation>true</failOnViolation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/ranger-examples/sample-client/pom.xml b/ranger-examples/sample-client/pom.xml
index 662a031102..26035fd5b0 100644
--- a/ranger-examples/sample-client/pom.xml
+++ b/ranger-examples/sample-client/pom.xml
@@ -55,4 +55,18 @@
             <version>${slf4j.version}</version>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                    <failOnViolation>true</failOnViolation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/ranger-examples/sampleapp/pom.xml b/ranger-examples/sampleapp/pom.xml
index 6f1f5a7224..6e706d39f1 100644
--- a/ranger-examples/sampleapp/pom.xml
+++ b/ranger-examples/sampleapp/pom.xml
@@ -38,4 +38,18 @@
             <version>${slf4j.version}</version>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-pmd-plugin</artifactId>
+                <configuration>
+                    <rulesets>
+                        <ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+                    </rulesets>
+                    <failOnViolation>true</failOnViolation>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java b/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
index 155f62fb3d..ad951af120 100644
--- a/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
+++ b/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
@@ -19,6 +19,7 @@
 
 package org.apache.ranger.examples.sampleapp;
 
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Scanner;
 import java.util.Set;
@@ -52,7 +53,7 @@ public void init() {
 	public void run() {
 		LOG.debug("==> SampleApp.run()");
 
-		do {
+		while(true) {
 			String input = getInput();
 
 			if(input == null) {
@@ -69,9 +70,7 @@ public void run() {
 			String      userName   = getStringArg(args, 2);
 			Set<String> userGroups = new HashSet<String>();
 
-			for(int i = 3; i < args.length; i++) {
-				userGroups.add(args[i]);
-			}
+			userGroups.addAll(Arrays.asList(args).subList(3, args.length));
 
 			if(fileName == null || accessType == null || userName == null) {
 				LOG.info("Insufficient arguments. Usage: <accessType> <fileName> <userName> [userGroup1 userGroup2 userGroup3 ..]");
@@ -90,7 +89,7 @@ public void run() {
 			} else {
 				LOG.info("Not authorized!");
 			}
-		} while(true);
+		}
 
 		LOG.debug("<== SampleApp.run()");
 	}