5

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?

janusz j
  • 321
  • 3
  • 17
  • 1
    The problem (and the solution) is described here: https://stackoverflow.com/questions/55571046/eclipse-is-confused-by-imports-accessible-from-more-than-one-module – Mar-Z Sep 17 '20 at 13:29

1 Answers1

0

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>
Mar-Z
  • 2,660
  • 2
  • 4
  • 16