Ensure projects can be imported into Eclipse IDE with JDK 17
Prior to this commit, the Spring Framework projects could not be imported into Eclipse IDE when using JDK 17 to build the projects. The primary obstacle is the fact that Eclipse enforces a strict "no split packages between the unnamed module and a system module" rule when building with a "modular JDK" (such as JDK 17). Resources: - https://bugs.eclipse.org/bugs/show_bug.cgi?id=536928 - https://bugs.openjdk.java.net/browse/JDK-8215739 - http://mail.openjdk.java.net/pipermail/jigsaw-dev/2018-December/014077.html - https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10/53824670#53824670 Since the bug (JDK-8215739) has not been fixed in OpenJDK, the strict "no split packages" rule does not apply to the Java compiler used in Spring Framework's Gradle build or the compiler in IntelliJ IDEA. Hence, this issue only arrises when building the framework in Eclipse IDE. This commit addresses this issue in the following affected projects. - spring-oxm: removal of the dependency on XPP3 which publishes javax.xml.namespace.QName as part of the JAR. The QName type is also published by the java.xml JDK 17 system module. To make the tests pass, we have switched to using the DomDriver instead of the XppDriver in our XStream tests. - spring-test: HtmlUnit has a transitive dependency on xml-apis which publishes several packages also published by java.xml JDK 17 system module. Thus, we have explicitly excluded the transitive dependency on xml-apis for our `optional` configuration. See gh-27407
This commit is contained in:
@@ -79,6 +79,15 @@ dependencies {
|
||||
testRuntimeOnly("com.sun.xml.bind:jaxb-impl")
|
||||
}
|
||||
|
||||
// Prevent xml-apis from being used so that the corresponding XML APIs from
|
||||
// the JDK's `java.xml` module are used instead. This allows spring-test to
|
||||
// build in Eclipse IDE which fails to compile if there is a split package
|
||||
// between a JDK system module and the unnamed module (for JARs on the
|
||||
// classpath).
|
||||
configurations.optional {
|
||||
exclude group: "xml-apis", module: "xml-apis"
|
||||
}
|
||||
|
||||
test {
|
||||
description = "Runs JUnit 4, JUnit Jupiter, and TestNG tests."
|
||||
useJUnitPlatform {
|
||||
|
||||
Reference in New Issue
Block a user