Without this change I get compiler errors from JDT in the IDE (VSCode). It seems to be harmless from the point of view of the command line build with the JDK.

Comment From: wilkinsona

That's a bit odd. It works fine with JDT in Eclipse. What are the compile errors you're getting?

Comment From: dsyer

The package javax.xml.transform is accessible from more than one module

Comment From: dsyer

This looks related: https://bugs.eclipse.org/bugs/show_bug.cgi?id=545621 (they say it's a bug in JDK that causes a false positive not JDT problem).

Comment From: wilkinsona

xercesImpl only contains org.apache.* and org.w3c.dom.html packages. I guess that it's its dependency on xml-apis that's the problem and is probably what, if anything, should be excluded. It contains a superset of the packages that are in the JDK so excluding it may break something.

We have three other modules that transitively depend on xml-apis:

  • spring-boot-test
  • spring-boot-test-autoconfigure
  • spring-boot-smoke-test-test

While spring-boot-test and spring-boot-test-autoconfigure are depended on by users, they won't pick up the xml-apis dependency as it's pulled in via an optional dependency on HTML Unit.

I guess we can try excluding it across all four modules and see what happens.

Comment From: sbrannen

In https://github.com/spring-projects/spring-framework/commit/a247b83cd9c9aefd3c329d493c5ce7cd11d0cdfa, you can see what we had to do for Spring Framework as well as additional resources on the subject.

Comment From: wilkinsona

It works fine with JDT in Eclipse

Looking more closely at my Boot 3.0 Eclipse workspace, this isn't the case. The only errors we used to get were a handful of erroneous "The target type of this expression must be a functional interface" errors but I'm now seeing a number of "accessible from more than one module" errors too. I'm still on Eclipse 2021-09.

Comment From: wilkinsona

Thanks, @sbrannen. It's useful to know that you were able to exclude xml-apis without any problems.

Comment From: wilkinsona

The problem only appears in Eclipse if you have xml-apis on the classpath and there's code in the project that uses code in a package that's then in both the unnamed module and the java.xml module. As a result of this, it's only spring-boot-docs that's affected as spring-boot-test, spring-boot-test-autoconfigure, and spring-boot-smoke-test-test don't use any java.xml APIs.