on-internet
← Community

Gradle difference between compileJava and tasks.withType(JavaCompile)

Stack Overflow ·

I'm currently trying to convert an old code base from Java 8 to Java 11. Part of this old code base uses some Java-internal classes (specifically sun.security.x509). In order to make this work in Java 11 I have to add the "add-exports" flag to my compileJava task in Gradle to allow this internal class to be visible outside its module. So I started with this: compileJava { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 options.compilerArgs = [ '--add-exports=java.base/sun.security.x509=ALL-UNNAMED' ] } This doesn't seem to work, as the add-exports does

Comments

Sign in or sign up to comment and upvote.

No comments yet.