HubSpot/modernizer-maven-plugin

Name: modernizer-maven-plugin

Owner: HubSpot

Description: Detect uses of legacy Java APIs

Forked from: gaul/modernizer-maven-plugin

Created: 2018-02-20 17:43:24.0

Updated: 2018-03-30 19:40:35.0

Pushed: 2018-03-30 21:09:29.0

Homepage:

Size: 259

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Modernizer Maven Plugin

Modernizer Maven Plugin detects uses of legacy APIs which modern Java versions supersede. These modern APIs are often more performant, safer, and idiomatic than the legacy equivalents. For example, Modernizer can detect uses of Vector instead of ArrayList, String.getBytes(String) instead of String.getBytes(Charset), and Guava Objects.equal instead of Java 7 Objects.equals. The default configuration detects over 100 legacy APIs, including third-party libraries like Guava.

Configuration

To run Modernizer, add the following to the <plugins> stanza in your pom.xml then invoke mvn modernizer:modernizer:

gin>
roupId>org.gaul</groupId>
rtifactId>modernizer-maven-plugin</artifactId>
ersion>1.6.0</version>
onfiguration>
<javaVersion>1.8</javaVersion>
configuration>
ugin>

The <configuration> stanza can contain several elements:

To run Modernizer during the verify phase of your build, add the following to the modernizer <plugin> stanza in your pom.xml:

cutions>
xecution>
<id>modernizer</id>
<phase>verify</phase>
<goals>
  <goal>modernizer</goal>
</goals>
execution>
ecutions>

Command-line flags can override Modernizer configuration and ModernizerMojo documents all of these. The most commonly used flags:

Suppression

Add @SuppressWarnings("modernizer") to any class or method to suppress all Modernizer violations within it.

To enable this, add the following to the <dependencies> stanza in your pom.xml:

endency>
roupId>org.gaul</groupId>
rtifactId>modernizer-annotation-processor</artifactId>
ersion>1.6.0</version>
cope>provided</scope>
pendency>
References
License

Copyright © 2014-2018 Andrew Gaul

Licensed under the Apache License, Version 2.0


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.