Hello,
I'm porting a project to Java 21. It makes some use of packages in the java.xml module, e.g. org.w3c.dom. When I switch java.version to 21, Eclipse complains:
[In case the image is dropped: The package org.w3c.dom is accessible from more than one module: <unnamed>, java.xml]
That's fair enough, and it's true: JavaXML.framework smuggles in a bunch of packages, including this one. To be clear, though, it only seems to be Eclipse complaining: mvn package still builds the app bundle without complaint. My first thought was to exclude it via the POM, which works to remove those warnings, but then in deployment:
2025-05-05 04:45:11.012 WARN NSLog - Instance Request: Error parsing: <instanceRequest type="NSDictionary"> <queryInstance type="NSString">STATISTICS</queryInstance> </instanceRequest>
Turns out Xerces is expected to be available on the classpath to parse messages from wotaskd. (Thanks Ramsey from 2013!) It seems to be sufficient to import Xerces alone:
<dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.12.2</version> <scope>runtime</scope> </dependency>
But then I get the Eclipse warnings back, though now just for src/test classes: "runtime" scope causes Eclipse to ignore it for the app, but runtime-scoped artifacts are still provided for test compilation, hence Eclipse complains again (because we use colliding packages in some tests).
Finally, I can silence Eclipse by putting this in .settings/org.eclipse.jdt.core.prefs:
org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage=enabled
What a roller coaster. Now, my questions:
1. Has anyone else hit this, and, if so, what did you do about it?
2. Is anyone else living in a post-JavaXML.framework world? It smuggles in a lot of stuff that I'd like to get rid of (e.g., Log4J 1). If so, how did you do it?
-- Paul Hoadley https://logicsquad.net/ https://www.linkedin.com/company/logic-squad/
|