如何使用JDK 14使JAXB API对项目可见

问题描述


我正在尝试使用JDK 14将使用JAXB API的一些旧代码改装到我的JavaFx项目中。我正在Windows 10上使用Netbeans 12.0。这是导致编译器错误代码片段(import语句)。我花了几天时间,到目前为止还没有运气。任何见解都会很棒。

谢谢。

package org.openjfx.mavenfxedittableview;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlElement;
import java.util.List;

    

@XmlRootElement (name="Persons")
public class PersonListWrapper {
    
}


这是POM文件中的依赖项片段

<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>14</version>
    </dependency>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>14</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>
</dependencies>


这是编译器错误

COMPILATION ERROR : 
-------------------------------------------------------------
org/openjfx/mavenfxedittableview/PersonListWrapper.java:[8,22] package javax.xml.bind.annotation is not visible
  (package javax.xml.bind.annotation is declared in the unnamed module,but module org.openjfx.mavenfxedittableview does not read it)
org/openjfx/mavenfxedittableview/PersonListWrapper.java:[9,but module org.openjfx.mavenfxedittableview does not read it)
2 errors

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)