AVRO-1838: Java: Update checkstyle to catch trailing whitespace. Contributed by Niels Basjes.
diff --git a/CHANGES.txt b/CHANGES.txt
index 86f280d..4eac415 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -35,6 +35,9 @@
 
     AVRO-1839: Update the gitignore files to hide generated files (nielsbasjes)
 
+    AVRO-1838: Java: Update checkstyle to catch trailing whitespace.
+    (nielsbasjes via blue)
+
   BUG FIXES
 
     AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are
diff --git a/lang/java/checkstyle.xml b/lang/java/checkstyle.xml
deleted file mode 100644
index a51089a..0000000
--- a/lang/java/checkstyle.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-   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.
--->
-
-<!DOCTYPE module PUBLIC
-    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
-    <module name="FileTabCharacter"/>
-    <module name="NewlineAtEndOfFile">
-        <property name="lineSeparator" value="lf"/>
-    </module>
-
-    <module name="TreeWalker">
-        <module name="ConstantName"/>
-        <module name="LocalFinalVariableName"/>
-        <module name="LocalVariableName"/>
-        <module name="MemberName"/>
-        <module name="MethodName"/>
-        <module name="PackageName"/>
-        <module name="ParameterName"/>
-        <module name="StaticVariableName"/>
-        <module name="TypeName"/>
-
-        <module name="AvoidStarImport"/>
-        <module name="RedundantImport"/>
-        <module name="UnusedImports"/>
-
-        <module name="RedundantModifier"/>
-
-        <module name="EmptyStatement"/>
-        <module name="IllegalInstantiation"/>
-        <module name="RedundantThrows"/>
-        <module name="SimplifyBooleanExpression"/>
-        <module name="SimplifyBooleanReturn"/>
-
-        <module name="InterfaceIsType"/>
-
-        <module name="ArrayTypeStyle"/>
-        <module name="UpperEll"/>
-
-    </module>
-</module>
diff --git a/lang/java/pom.xml b/lang/java/pom.xml
index c315ea4..4e5ddd8 100644
--- a/lang/java/pom.xml
+++ b/lang/java/pom.xml
@@ -74,7 +74,6 @@
     <findbugs-annotations.version>1.3.9-1</findbugs-annotations.version>
 
     <!-- version properties for plugins -->
-    <checkstyle-plugin.version>2.12.1</checkstyle-plugin.version>
     <bundle-plugin-version>2.5.3</bundle-plugin-version>
     <compiler-plugin.version>3.1</compiler-plugin.version>
     <exec-plugin.version>1.3.2</exec-plugin.version>
@@ -236,27 +235,6 @@
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>${checkstyle-plugin.version}</version>
-          <configuration>
-            <consoleOutput>true</consoleOutput>
-            <configLocation>checkstyle.xml</configLocation>
-          </configuration>
-          <!-- Runs by default in the verify phase  (mvn verify or later in the build cycle)
-               the 'check' goal will fail the build if it does not pass.  "mvn checkstyle:check"
-               will do this alone, or "mvn checkstyle:checkstyle" will report but not break  -->
-          <executions>
-            <execution>
-              <id>checkstyle-check</id>
-              <phase>test</phase>
-              <goals>
-                <goal>check</goal>
-              </goals>
-            </execution>
-          </executions>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-javadoc-plugin</artifactId>
           <version>${javadoc-plugin.version}</version>
           <configuration>
@@ -308,10 +286,6 @@
     </pluginManagement>
     <plugins>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-      </plugin>
-      <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <version>${bundle-plugin-version}</version>
diff --git a/lang/java/trevni/avro/pom.xml b/lang/java/trevni/avro/pom.xml
index 84895a5..f2380fe 100644
--- a/lang/java/trevni/avro/pom.xml
+++ b/lang/java/trevni/avro/pom.xml
@@ -50,10 +50,6 @@
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>
diff --git a/lang/java/trevni/checkstyle.xml b/lang/java/trevni/checkstyle.xml
deleted file mode 100644
index a51089a..0000000
--- a/lang/java/trevni/checkstyle.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-   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.
--->
-
-<!DOCTYPE module PUBLIC
-    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
-    <module name="FileTabCharacter"/>
-    <module name="NewlineAtEndOfFile">
-        <property name="lineSeparator" value="lf"/>
-    </module>
-
-    <module name="TreeWalker">
-        <module name="ConstantName"/>
-        <module name="LocalFinalVariableName"/>
-        <module name="LocalVariableName"/>
-        <module name="MemberName"/>
-        <module name="MethodName"/>
-        <module name="PackageName"/>
-        <module name="ParameterName"/>
-        <module name="StaticVariableName"/>
-        <module name="TypeName"/>
-
-        <module name="AvoidStarImport"/>
-        <module name="RedundantImport"/>
-        <module name="UnusedImports"/>
-
-        <module name="RedundantModifier"/>
-
-        <module name="EmptyStatement"/>
-        <module name="IllegalInstantiation"/>
-        <module name="RedundantThrows"/>
-        <module name="SimplifyBooleanExpression"/>
-        <module name="SimplifyBooleanReturn"/>
-
-        <module name="InterfaceIsType"/>
-
-        <module name="ArrayTypeStyle"/>
-        <module name="UpperEll"/>
-
-    </module>
-</module>
diff --git a/lang/java/trevni/core/pom.xml b/lang/java/trevni/core/pom.xml
index 084b167..fcd3d14 100644
--- a/lang/java/trevni/core/pom.xml
+++ b/lang/java/trevni/core/pom.xml
@@ -44,15 +44,6 @@
     </dependency>
   </dependencies>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-      </plugin>
-    </plugins>
-  </build>
-
   <profiles>
   </profiles>
 
diff --git a/pom.xml b/pom.xml
index cf164ce..fda01a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,7 @@
        Java artifacts are copied to the final build destination with a custom profile.
        -->
   <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <avro.distDir>dist</avro.distDir>
     <avro.docDir>build/avro-doc-${project.version}/api</avro.docDir>
     <!-- dependency plugin versions -->
@@ -53,9 +54,11 @@
     <antrun-plugin.version>1.7</antrun-plugin.version>
     <enforcer-plugin.version>1.3.1</enforcer-plugin.version>
     <rat.version>0.9</rat.version>
+    <checkstyle-plugin.version>2.17</checkstyle-plugin.version>
   </properties>
 
   <modules>
+    <module>dev-tools</module>
     <module>lang/java</module>
   </modules>
 
@@ -118,6 +121,35 @@
           <fail>true</fail>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${checkstyle-plugin.version}</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.avro</groupId>
+            <artifactId>dev-tools</artifactId>
+            <version>${project.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <consoleOutput>true</consoleOutput>
+          <configLocation>checkstyle/checkstyle.xml</configLocation>
+          <suppressionsLocation>checkstyle/suppressions.xml</suppressionsLocation>
+        </configuration>
+        <!-- Runs by default in the verify phase  (mvn verify or later in the build cycle)
+             the 'check' goal will fail the build if it does not pass.  "mvn checkstyle:check"
+             will do this alone, or "mvn checkstyle:checkstyle" will report but not break  -->
+        <executions>
+          <execution>
+            <id>checkstyle-check</id>
+            <phase>test</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>