JDK9+之后使用JXAB 发表于 2021-10-13 分类于 Java 阅读次数: 本文字数: 78 阅读时长 ≈ 1 分钟 <dependencies> <!-- jdk9+ requires following dependencies to use jaxb --> <dependency> <groupId>jakarta.xml.bind</groupId> <artifactId>jakarta.xml.bind-api</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>3.0.1</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>3.0.1</version> </dependency></dependencies>module-info.javamodule module.name { requires static transitive java.naming; requires transitive com.sun.xml.bind; requires java.annotation; // 使用到JAXB相关的包暴露给jaxb opens cn.xiaojianzheng.xxx to com.sun.xml.bind, com.sun.xml.bind.core, jakarta.xml.bind;}