Both on Eclipse Oxygen and Photon, with Gradle 4.7 and 4.9, and with Buildship 2.2.1 and 3.x beta, using Java 10.0.2, the same behavior is present: all the added exports and explicitly included modules our developers manually add to the ‘Is modular’ node of the ‘JRE System Library’ tree root of the Java Build Path dialog’s ‘Libraries’ tab are all deleted when ‘Refresh Gradle Project’ is called via the context menu of any project.
This is maddening! We have modified all of the pertinent gradle.build files of the corresponding projects, adding compileJava blocks like so:
options.compilerArgs += ["–add-modules", “java.xml.bind”]
options.compilerArgs += ["–add-exports", “java.desktop/com.sun.swing.internal.plaf.synth.resources”]
Our application build perfectly now from the command line via gradlew, but in eclipse we can not run since these necessary modules are missing. Repeatedly. We add them. Buildship removes them.
I found something that is reported to be a workaround, but adding the ‘snippet’ to our build.gradle files has no effect: https://github.com/eclipse/buildship/issues/620#issuecomment-350987316
Is the referenced snippet supposed to go in our projects’ build.gradle files? Seems like it should be somewhere in a config file for buildship itself, no?
In any case, we’ve been using Eclipse for many years, and we have a mandate to move to Java 11 per our support agreements with Oracle, which requires dealing with modules. We want to stay with Eclipse, but this issue is extremely problematic. We don’t want to use IntelliJ, but it handles this situation perfectly; it all just works.
Please tell me what if anything can be done. Thank you.