【发布时间】:2021-09-25 04:39:24
【问题描述】:
切换到 java 11 后,com.sun.org.apache.xerces.internal.dom#DOMInputImpl() 出现问题。在此代码中:
@Override
public LSInput resolveResource(final String type,
final String namespaceURI, final String publicId, String systemId,
final String baseURI) {
final LSInput input = new DOMInputImpl();
if (systemId.equals(this.systemId)) {
try {
input.setByteStream(xsdFile.getInputStream());
} catch (IOException e) {
log.error("Error to get classpath resource for schema");
}
}
return input;
}
编译时出现错误:
错误:(8,42) java: com.sun.org.apache.xerces.internal.dom 包不可见
我尝试添加到 maven-surefire-plugin --add-exports... 但它没有帮助我
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<argLine>--illegal-access=permit</argLine>
<argLine>--add-exports java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED</argLine>
<argLine>-Dillegal-access=permit</argLine>
</configuration>
</plugin>
【问题讨论】:
-
也许值得一试
<argLine>--add-modules java.xml</argLine>
标签: java java-8 java-11 maven-surefire-plugin