tbroyer / gradle-errorprone-plugin

Gradle plugin to use the error-prone compiler for Java
Apache License 2.0
366 stars 32 forks source link

Error: Plug In Not Found - ErrorProne #103

Closed chirdeeptomar closed 1 month ago

chirdeeptomar commented 1 month ago

I have both the gradle plugin and the errorprone dependency set with correct version from error_prone_core and I am still getting Plugin not found error.

I have Java 21, Gradle 8.8 with Kotlin DSL.

Source URL

import net.ltgt.gradle.errorprone.errorprone

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    application
    id("net.ltgt.errorprone") version "4.0.0"
    id("io.freefair.lombok") version "8.6"
    id("com.github.johnrengelman.shadow") version "8.1.1"
}

val camelVersion = "4.8.0"
val log4jVersion = "2.23.1"
val errorproneVersion = "2.32.0"

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    implementation("org.apache.camel:camel-core:${camelVersion}")
    implementation("org.apache.camel:camel-main:${camelVersion}")
    ..... 
    implementation("org.apache.logging.log4j:log4j-core:${log4jVersion}")

    errorprone("com.google.errorprone:error_prone_core:$errorproneVersion")
    runtimeOnly("org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}")
}

testing {
    suites {
        // Configure the built-in test suite
        val test by getting(JvmTestSuite::class) {
            // Use JUnit Jupiter test framework
            useJUnitJupiter("5.9.1")
        }
    }
}

application {
    // Define the main class for the application.
    mainClass.set("com.empyrean.camel.App")
}

tasks.withType<JavaCompile>().configureEach {
    options.errorprone.disableWarningsInGeneratedCode.set(true)
    options.compilerArgs.addAll(listOf(
        "-Xplugin:ErrorProne",
        "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
        "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
        "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
        "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED"
    ))
}

Appreciate your help.