I’m adding Checker Framework to an existing Java Gradle build. I have Checker integrated and raising issues and that’s all working great. But now that I’ve added it, my build is no longer producing a .jar file as it once did.
Previously, I’d get a .jar at build/libs/myproject.jar
. Now instead I see build/checkerframework
and build/main
but no build/libs
and no .jar.
My build.gradle
is below. Anyone attempted this before? Any success?
I guess I’d also accept an answer that shows how run Checker outside of the build, e.g. gradle check
to run a build with Checker, and gradle build
to produce a .jar. But I’d really prefer to have just a single build step if at all possible.
Thanks!
plugins { id "org.checkerframework" version "0.5.18" id 'application' } apply plugin: 'org.checkerframework' checkerFramework { checkers = [ 'org.checkerframework.checker.nullness.NullnessChecker', 'org.checkerframework.checker.units.UnitsChecker' ] } repositories { jcenter() } java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE // Embed all dependencies to create a "fat jar" as required for AWS deployment. // Exclude 3rd-party signing files to prevent security errors at runtime from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } { exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA' } manifest { attributes('Main-Class': 'client.CliMain') } }
Advertisement
Answer
If the build is passing, then adding -processor
should not affect whether a .jar
file is produced. (Unless you pass -proc:only
or the like.)
If the build is failing, then Gradle won’t build the jar files. You said the Checker Framework is “raising issues”, so maybe the build is failing.