-
Type: Task
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Runtime
-
Epic Link:
-
Tags:
-
Sprint:nxcore 11.1.5, nxcore 11.1.6, nxcore 11.1.7, nxcore 11.1.8 / 11.1.9
-
Story Points:1
Since we are using JDK 11 to compile the Nuxeo Platform, see NXP-24952, we get these kind of errors in Eclipse when setting the Compiler Compliance Level to 11 in Preferences > Java > Compiler > JDK Compliance.
The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml
For instance in DomHelper from nuxeo-commons on:
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.xml.sax.InputSource; import org.xml.sax.SAXException;
Basically, this happens on all the packages that are split between classpath (pom.xml) and system image (JDK).
This is only visible in Eclipse because it uses its own Java compiler, which apparently adheres to the Java Language Specification more closely than Oracle's own compiler.
Yet, having for instance both xml-apis and JRE 9+ in our dependencies is no longer valid according to JLS 9+.
It seems that we'll have to remove all dependencies to these "duplicate" packages and always add exclusions to avoid transitive dependencies.
But this is not trivial: to fix the issue with org.w3c.dom, removing dependencies on xml-apis is not enough as it is also exposed by some libs like xercesImpl.
Workaround for Eclipse: set the Compiler Compliance Level to 1.8.
See:
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-December/014077.html
tl;dr A package split between the classpath and the system image is just
as bad as a package split between two modules on the modulepath.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928
Eclipse is not the cause, we're just the messenger of a situation that has become illegal.
When Java 13 fixes https://bugs.openjdk.java.net/browse/JDK-8215739 your current structure will definitely stop to compile also in maven. Nothing we can possibly fix in Eclipse.
https://bugs.openjdk.java.net/browse/JDK-8215739
javac does not detect split packages between classpath and system image
- depends on
-
VEND-42 Exlcude org.w3c.dom.UserDataHandler from jaxen:1.1.6
- Resolved
-
NXP-24952 Compile Nuxeo with Java 11
- Resolved
-
VEND-41 Exlcude java.lang.Objects from webdav-jaxrs:1.2.1
- Resolved
-
VEND-43 Exlcude org.w3c.dom.html.HTMLDOMImplementation from xercesImpl:2.12.0
- Resolved
- is related to
-
NXP-30217 Fix Maven dependency analyze
- Resolved
-
NXP-28018 Upgrade Apache Santuario (xmlsec)
- Resolved
- is required by
-
NXP-28325 Upgrade maven-dependency-plugin
- Resolved