/error-prone

Catch common Java mistakes as compile-time errors

Primary LanguageJavaApache License 2.0Apache-2.0

Error Prone

Catch common Java mistakes as compile-time errors

Build Status Gitter chat

Getting Started

Our documentation for users is at http://errorprone.info

Maven

Add the following configuration to your pom.xml.

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.1</version>
      <configuration>
        <compilerId>javac-with-errorprone</compilerId>
        <forceJavacCompilerUse>true</forceJavacCompilerUse>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-compiler-javac-errorprone</artifactId>
          <version>2.5</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>
</build>

Ant

Download the latest release of Error Prone from maven, and add the following javac task in your build.xml.

<javac destdir="build"
  compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"
  encoding="UTF-8" debug="true"
  includeantruntime="false">
  <src path="src"/>
  <compilerclasspath>
    <pathelement location="./path/to/error_prone_ant.jar"/>
  </compilerclasspath>
</javac>

See examples/ant for alternate ant configurations.

Gradle

The gradle plugin is an external contribution. The documentation and code is at tbroyer/gradle-errorprone-plugin

Developing Error Prone

To develop and build Error Prone, see our documentation on the wiki.

Links