Maven project using Xerces 2 with Java 11

Viewed 576

Am trying to use Xerces 2 with Java 11 to create a maven project with modules, but it doesn't seem to work.

I found some suggestions online but none of them is working for me.

Here is my pom.xml


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>net.sample</groupId>
        <artifactId>xsd-project</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>client-ui</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>client-ui</name>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>11</java.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.12.1</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.4</version>
                <configuration>
                    <mainClass>net.sample.Main</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.5.2</version>
            </plugin>
        </plugins>
    </build>

</project>


And here is the module info:


module client.ui {
    requires spring.boot.autoconfigure;
    requires spring.context;
    requires spring.boot;
    requires lombok;
    requires org.apache.commons.collections4;
    requires org.apache.commons.lang3;
    requires xercesImpl;
}

When I try to compile, I get the following error:

Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Copying resources... [client-ui]
Parsing java... [client-ui]
java: java.lang.reflect.InvocationTargetException
Modules jdk.xml.dom and xercesImpl export package org.w3c.dom.html to module spring.boot
java: java.lang.reflect.InvocationTargetException
Checking dependencies... [client-ui]
Dependency analysis found 0 affected files
Errors occurred while compiling module 'client-ui'
javac 11.0.9 was used to compile java sources
Finished, saving caches...
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
8/8/2021 2:03 PM - Build completed with 2 errors and 0 warnings in 1 sec, 199 ms

Any suggestions or ideas on whether Xerces 2 can work with Java 11?

0 Answers
Related