简体   繁体   中英

The package javax.xml.stream is accessible from more than one module: <unnamed>, java.xml

I have compilation error: The package javax.xml.stream is accessible from more than one module: <unnamed>, java.xml . Application with maven install build succesfully but it doesn't run as java application.

CTRL + SHIFT + T shows me that javax.xml.stream package is a part of JDK-11 (Modulepath) and stax-api (Classpath). stax-api is a dependency of parent module which cannot be deleted. This problem occurs on Eclipse 2019-12, 2020-03, 2020-06 and IntelliJ and different versions of Java 11.

I tried so far to exclude javax.xml.stream for all dependencies within child <exclude>javax.xml.stream</exclude> but with no success.

How can I resolve this issue?

I tried so far to exclude javax.xml.stream for all dependencies within child <exclude>javax.xml.stream</exclude> but with no success.

Not sure how you did the exclusion? I would say it should be done in pom.xml. Similar to this:

<dependency>
    <groupId>A_GROUP_ID</groupId>
    <artifactId>AN_ARTIFACT_ID</artifactId>
    <exclusions>
        <exclusion>
            <groupId>javax.xml.stream</groupId>
            <artifactId>stax-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM