The package org.w3c.dom is accessible from more than one module: , java.xml

I had a similar issue because of a transitive xml-apis dependency. I resolved it using a Maven exclusion:

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>fop</artifactId>
    <version>0.95</version>
    
    <exclusions>
        <exclusion>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Another dependency that just causes trouble and I don’t have a solution other than removing it is this one:

<dependency>
    <groupId>com.oracle.database.xml</groupId>
    <artifactId>xmlparserv2</artifactId>
    <version>${oracle.version}</version>
</dependency>

Use mvn dependency:tree to see who brings in the transitive dependency, and then exclude that from there.

Leave a Comment