Skip to content

Commit 1d031b0

Browse files
committed
Exclude legacy XML API dependencies and use java.xml module instead
Java 9 and higher provide the standard XML APIs (javax.xml.parsers, org.w3c.dom, org.xml.sax, etc.) in the java.xml module. Several dependencies in the project depended directly or transitively on older versions of these APIs via artifacts such as xml-apis:xml-apis, xml-apis:xml-apis-ext and xerces:xmlParserAPIs. When both the JDK and a dependency define the same package, certain compilers, especially the Eclipse Java Compiler (ECJ), fail with errors such as "X is accessible from more than one module: javax.xml, <unnamed>". Ensure that Maven does not include the legacy artifacts xml-apis:xml-apis, xml-apis:xml-apis-ext, xml-apis:xmlParserAPIs or xerces:xmlParserAPIs; but relies on the java.xml module instead (GeoNetwork requires at least Java 11). Update xom:xom from 1.1 to 1.3.9, which no longer bundles org.w3c.dom classes and improves compatibility with more JDK versions (see https://xom.nu/history.html). Update jaxen:jaxen from to 1.1.4 to 1.2.0, which no longer bundles org.w3c.dom classes (see https://www.cafeconleche.org/jaxen/releases.html). Update commons-digester:commons-digester from 1.6 to 1.8.1, which marks xml-apis as provided instead of compile (see apache/commons-digester@05b3ffc988d8dad0db461b fb35598a244e32f4f6).
1 parent e667f25 commit 1d031b0

2 files changed

Lines changed: 71 additions & 10 deletions

File tree

core/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,6 @@
563563
<dependency>
564564
<groupId>org.owasp.esapi</groupId>
565565
<artifactId>esapi</artifactId>
566-
<version>2.5.4.0</version>
567-
<exclusions>
568-
<exclusion>
569-
<groupId>log4j</groupId>
570-
<artifactId>log4j</artifactId>
571-
</exclusion>
572-
</exclusions>
573566
</dependency>
574567
<dependency>
575568
<groupId>org.xmlunit</groupId>

pom.xml

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@
266266
</goals>
267267
<configuration>
268268
<rules>
269+
<bannedDependencies>
270+
<excludes>
271+
<exclude>xml-apis:xml-apis</exclude>
272+
<exclude>xml-apis:xml-apis-ext</exclude>
273+
<exclude>xml-apis:xmlParserAPIs</exclude>
274+
<exclude>xerces:xmlParserAPIs</exclude>
275+
</excludes>
276+
</bannedDependencies>
269277
<requireMavenVersion>
270278
<version>3.8.3</version>
271279
</requireMavenVersion>
@@ -482,6 +490,16 @@
482490
<groupId>org.apache.xmlgraphics</groupId>
483491
<artifactId>fop</artifactId>
484492
<version>${fop.version}</version>
493+
<exclusions>
494+
<exclusion>
495+
<groupId>xml-apis</groupId>
496+
<artifactId>xml-apis</artifactId>
497+
</exclusion>
498+
<exclusion>
499+
<groupId>xml-apis</groupId>
500+
<artifactId>xml-apis-ext</artifactId>
501+
</exclusion>
502+
</exclusions>
485503
</dependency>
486504

487505
<dependency>
@@ -522,7 +540,7 @@
522540
<dependency>
523541
<groupId>commons-digester</groupId>
524542
<artifactId>commons-digester</artifactId>
525-
<version>1.6</version>
543+
<version>1.8.1</version>
526544
</dependency>
527545
<dependency>
528546
<groupId>org.apache.commons</groupId>
@@ -621,11 +639,28 @@
621639
<groupId>xerces</groupId>
622640
<artifactId>xercesImpl</artifactId>
623641
<version>2.12.2</version>
642+
<exclusions>
643+
<exclusion>
644+
<groupId>xml-apis</groupId>
645+
<artifactId>xml-apis</artifactId>
646+
</exclusion>
647+
<exclusion>
648+
<groupId>xml-apis</groupId>
649+
<artifactId>xml-apis-ext</artifactId>
650+
</exclusion>
651+
</exclusions>
624652
</dependency>
625653
<dependency>
626654
<groupId>xml-apis</groupId>
627655
<artifactId>xml-apis</artifactId>
628656
<version>1.4.01</version>
657+
<scope>provided</scope>
658+
</dependency>
659+
<dependency>
660+
<groupId>xml-apis</groupId>
661+
<artifactId>xml-apis-ext</artifactId>
662+
<version>1.3.04</version>
663+
<scope>provided</scope>
629664
</dependency>
630665

631666
<dependency>
@@ -850,7 +885,7 @@
850885
<dependency>
851886
<groupId>jaxen</groupId>
852887
<artifactId>jaxen</artifactId>
853-
<version>1.1.4</version>
888+
<version>1.2.0</version>
854889
</dependency>
855890
<dependency>
856891
<groupId>org.quartz-scheduler</groupId>
@@ -859,6 +894,25 @@
859894
</dependency>
860895

861896
<!-- Security stuff -->
897+
<dependency>
898+
<groupId>org.owasp.esapi</groupId>
899+
<artifactId>esapi</artifactId>
900+
<version>2.5.4.0</version>
901+
<exclusions>
902+
<exclusion>
903+
<groupId>log4j</groupId>
904+
<artifactId>log4j</artifactId>
905+
</exclusion>
906+
<exclusion>
907+
<groupId>xml-apis</groupId>
908+
<artifactId>xml-apis</artifactId>
909+
</exclusion>
910+
<exclusion>
911+
<groupId>xml-apis</groupId>
912+
<artifactId>xml-apis-ext</artifactId>
913+
</exclusion>
914+
</exclusions>
915+
</dependency>
862916
<dependency>
863917
<groupId>com.github.mwiede</groupId>
864918
<artifactId>jsch</artifactId>
@@ -888,6 +942,14 @@
888942
<groupId>log4j</groupId>
889943
<artifactId>log4j</artifactId>
890944
</exclusion>
945+
<exclusion>
946+
<groupId>xml-apis</groupId>
947+
<artifactId>xml-apis</artifactId>
948+
</exclusion>
949+
<exclusion>
950+
<groupId>xml-apis</groupId>
951+
<artifactId>xml-apis-ext</artifactId>
952+
</exclusion>
891953
</exclusions>
892954
</dependency>
893955

@@ -1196,7 +1258,13 @@
11961258
<dependency>
11971259
<groupId>xom</groupId>
11981260
<artifactId>xom</artifactId>
1199-
<version>1.1</version>
1261+
<version>1.3.9</version>
1262+
<exclusions>
1263+
<exclusion>
1264+
<groupId>xml-apis</groupId>
1265+
<artifactId>xml-apis</artifactId>
1266+
</exclusion>
1267+
</exclusions>
12001268
</dependency>
12011269
<dependency>
12021270
<groupId>org.xhtmlrenderer</groupId>

0 commit comments

Comments
 (0)