lemminx icon indicating copy to clipboard operation
lemminx copied to clipboard

xml-apis dependency causes build failure in JDT when migrating to JDK 11

Open Treehopper opened this issue 4 years ago • 4 comments

I checked if it would be possible to migrate to JDK, and ran into this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928 I learned that JDT is correctly reporting an error, whereas the Maven build incorrectly passes because of this JDK bug: https://bugs.openjdk.java.net/browse/JDK-8215739

I'd suggest to migrate to 11 now, and remove the xml-apis dependency. Apart from the benefits of a modern JDK, I'd argue that more such problems will accumulate over time, making migration only harder in the future.

Treehopper avatar Apr 24 '20 14:04 Treehopper

What do you mean by migrate to JDK 11? The project can build and run fine with JDK 11, produce a distribution perfectly working with Java 8

fbricon avatar Apr 24 '20 15:04 fbricon

I can confirm your observation. I'm compiling it with 14 myself. This is less an immediate issue, and more of a "timebomb".

Steps to reproduce the issue:

  • set maven-compiler-plugin configuration to use source and target 11
  • $ mvn clean compile #=> works because of bug JDK-8215739
  • remove existing .classpath files
  • import projects into eclipse (e.g. via m2e) => compile errors: "The package javax.xml.* is accessible from more than one module: javax.xml, "

Some day JDK-8215739 will be fixed, possibly in a patch-release of the JDK, then also the Maven build for this project breaks.

The immediate issue is that JDK 11 is simply more fun to work with. :-)

Treehopper avatar Apr 24 '20 16:04 Treehopper

Unfortunately, "more fun to work with" is not a compelling reason to require Java 11 at the moment, given that a majority of users are still stuck with Java 8. I'm not to worried about the migration to Java 11, once we reach that point though, it'll be a matter of removing one dependency. So I'll keep this issue on the backburner, hopefully not for too long, until we decide it's time to move on.

fbricon avatar May 05 '20 22:05 fbricon

See https://github.com/eclipse/lsp4j/issues/547. Once we move to lsp4j 0.13.0, we will need to support Java 11 properly.

datho7561 avatar May 25 '21 15:05 datho7561