Add modernizer-maven-plugin to build

This plugin finds uses of legacy APIs:

https://github.com/andrewgaul/modernizer-maven-plugin
This commit is contained in:
Andrew Gaul 2014-09-16 13:18:37 -07:00
parent b9f54a3301
commit 2d70087bfa
5 changed files with 51 additions and 41 deletions

View File

@ -280,7 +280,7 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
// HttpUrlConnection strips Content-Length: 0 without setDoOutput(true)
String method = connection.getRequestMethod();
if ("POST".equals(method) || "PUT".equals(method)) {
connection.setFixedLengthStreamingMode(0);
connection.setFixedLengthStreamingMode(0L);
connection.setDoOutput(true);
}
}

View File

@ -434,6 +434,7 @@
<exclude>**/.gitignore</exclude>
<exclude>**/.gitattributes</exclude>
<exclude>**/.java-version</exclude>
<exclude>**/modernizer_exclusions.txt</exclude>
<!-- Temporary files generated on CloudBees slaves -->
<exclude>.repository/**</exclude>
@ -714,6 +715,24 @@
<violationSeverity>warning</violationSeverity>
</configuration>
</plugin>
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>modernizer</id>
<phase>validate</phase>
<goals>
<goal>modernizer</goal>
</goals>
</execution>
</executions>
<configuration>
<javaVersion>1.7</javaVersion>
<exclusionsFile>resources/modernizer_exclusions.txt</exclusionsFile>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
@ -1107,6 +1126,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-resources</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>

View File

@ -88,44 +88,4 @@
<property name="format" value="@author"/>
<property name="message" value="Do not use Javadoc @author annotation"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new ArrayList&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Lists"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new HashMap&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Maps"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new HashSet&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Sets"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new LinkedHashMap&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Maps"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new LinkedHashSet&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Sets"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new LinkedList&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Lists"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new TreeMap&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Maps"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new TreeSet&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.collect.Sets"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="=\s*new AtomicReference&lt;[^&gt;]"/>
<property name="message" value="Prefer com.google.common.util.concurrent.Atomics"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="new StringBuffer"/>
<property name="message" value="Prefer java.lang.StringBuilder"/>
</module>
</module>

View File

@ -0,0 +1,19 @@
com/google/common/base/Charsets.ISO_8859_1:Ljava/nio/charset/Charset;
com/google/common/base/Charsets.US_ASCII:Ljava/nio/charset/Charset;
com/google/common/base/Charsets.UTF_8:Ljava/nio/charset/Charset;
com/google/common/base/Objects.equal:(Ljava/lang/Object;Ljava/lang/Object;)Z
com/google/common/base/Objects.hashCode:([Ljava/lang/Object;)I
com/google/common/collect/Lists.newArrayList:()Ljava/util/ArrayList;
com/google/common/collect/Lists.newArrayListWithCapacity:(I)Ljava/util/ArrayList;
com/google/common/collect/Lists.newLinkedList:()Ljava/util/LinkedList;
com/google/common/collect/Maps.newConcurrentMap:()Ljava/util/concurrent/ConcurrentMap;
com/google/common/collect/Maps.newHashMap:()Ljava/util/HashMap;
com/google/common/collect/Maps.newHashMap:(Ljava/util/Map;)Ljava/util/HashMap;
com/google/common/collect/Maps.newLinkedHashMap:()Ljava/util/LinkedHashMap;
com/google/common/collect/Maps.newLinkedHashMap:(Ljava/util/Map;)Ljava/util/LinkedHashMap;
com/google/common/collect/Maps.newTreeMap:()Ljava/util/TreeMap;
com/google/common/collect/Sets.newHashSet:()Ljava/util/HashSet;
com/google/common/collect/Sets.newLinkedHashSet:()Ljava/util/LinkedHashSet;
com/google/common/collect/Sets.newTreeSet:()Ljava/util/TreeSet;
com/google/common/primitives/Ints.compare:(II)I
com/google/common/primitives/Longs.compare:(JJ)I

View File

@ -37,6 +37,7 @@
<directory>${project.basedir}</directory>
<includes>
<include>checkstyle.xml</include>
<include>modernizer_exclusions.txt</include>
</includes>
</resource>
</resources>