在使用 xmlbeans 4.0.0 版和 xmlbeans-maven-plugin 2.3.3 生成模式时,我面临以下问题。这是因为 xmlbeans 版本 4.0.0 已经删除了 XMLStreamException 和 XMLInputStream 类。但问题是为什么它试图用不存在的类生成模式。
错误:找不到符号符号:类 XMLInputStream 位置:包 org.apache.xmlbeans.xml.stream fil2.java:148:
错误:找不到符号 public static com.mypackage.ConfigurationType parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans .xml.stream.XMLStreamException {
symbol: class XMLStreamException
location: package org.apache.xmlbeans.xml.stream
file1.java:201:
error: cannot find symbol
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
[ERROR] Failed to execute goal org.codehaus.mojo:xmlbeans-maven-plugin:2.3.3:xmlbeans (generate-source) on project dummyProject: XmlBeans compile failed:
[ERROR] xml ErrorLoading schema file
pom.xml is something like below:
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>generate-source</id>
<phase>generate-resources</phase>
<goals>
<goal>xmlbeans</goal>
</goals>
<inherited>true</inherited>
</execution>
</executions>
<configuration>
<schemaDirectory>${schema.directory}</schemaDirectory>
<sourceGenerationDirectory>${generated.directory}</sourceGenerationDirectory>
<javaSource>1.5</javaSource>
<xmlConfigs>
<xmlConfig implementation="java.io.File">${source.resources}/config/config.xsdconfig</xmlConfig>
</xmlConfigs>
</configuration>
</plugin>
</plugins>