Skip to content

Instantly share code, notes, and snippets.

@martijndwars
Created August 29, 2019 08:07
Show Gist options
  • Select an option

  • Save martijndwars/0c2e7ee68a58787d2f3f91f9e408fe74 to your computer and use it in GitHub Desktop.

Select an option

Save martijndwars/0c2e7ee68a58787d2f3f91f9e408fe74 to your computer and use it in GitHub Desktop.
plugins {
id 'java'
}
repositories {
jcenter()
}
dependencies {
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
}
compileJava {
doFirst {
println("compileOnly = ${configurations.compileOnly.files}")
println("compile = ${configurations.compile.files}")
println("compileClasspath = ${configurations.compileClasspath.files}")
}
}
configurations.compile.exclude group: 'com.google.code.findbugs', module: 'jsr305'
> Task :compileJava FAILED
compileOnly = [/Users/martijn/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar]
compile = []
compileClasspath = []
/private/tmp/gradletest/src/main/java/Main.java:1: error: cannot find symbol
import javax.annotation.Nullable;
^
symbol: class Nullable
location: package javax.annotation
/private/tmp/gradletest/src/main/java/Main.java:7: error: cannot find symbol
public void x(@Nullable String s) {
^
symbol: class Nullable
location: class Main
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment