简体   繁体   中英

Symbol is declared in module 'java.xml' which does not export package 'com.sun.org.apache.xpath.internal.operations'

On running a mvn clean install -e -X for a cloned repository I am getting the following compilation failure

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.21:compile (compile) on project search-service: Compilation failure

[ERROR] ~/src/main/kotlin/com/search/service/resources/Search.kt:[9,53] Symbol is declared in module 'java.xml' which does not export package 'com.sun.org.apache.xpath.internal.operations'

[ERROR] -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.21:compile (compile) on project search-service: Compilation failure ~/src/main/kotlin/com/udaan/search/service/resources/Search.kt:[9,53] Symbol is declared in module 'java.xml' which does not export package 'com.sun.org.apache.xpath.internal.operations'

I am the only person facing this issue, for the other people the build is successful.

mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 15.0.1, vendor: N/A, runtime: /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_IN, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.4", arch: "x86_64", family: "mac"

I have no experience with Kotlin, but I found your question while searching for an answer for my problem in a Java application.

I experienced this error

Symbol is declared in module 'java.xml' which does not export package 'com.sun.org.apache.xpath.internal.operations'

with XpathFactory within the same module after upgrading Java from version 11 to 17. I solved it by importing the xalan library using Maven:

<dependency>
    <groupId>xalan</groupId>
    <artifactId>xalan</artifactId>
    <version>2.7.2</version>
</dependency>

See also section Java EE here: https://blogs.oracle.com/javamagazine/post/its-time-to-move-your-applications-to-java-17-heres-why-and-heres-how

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