Skip to content

Provide errorprone options in Java-based Gradle Plugin #96

Closed Answered by tbroyer
assayire asked this question in Q&A
Discussion options

You must be logged in to vote

The extension is on each JavaCompile task's getOptions(), which you have to cast to ExtensionAware (note also how I used withType/configureEach to avoid eager task configuration):

project.getTasks().withType(JavaCompile.class).configureEach(javaCompile ->
    ((ExtensionAware) javaCompile.getOptions()).getExtensions().configure(ErrorProneOptions.class, options -> {
        options.getEnabled().set(true); // This should be the default anyway
        options.getAllErrorsAsWarnings().set(false);
        options.getExcludedPaths().set(".*/build/generated/.*");
        options.disable("InvalidParam");
    });

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@assayire
Comment options

@assayire
Comment options

Answer selected by assayire
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants