首页 > 解决方案 > 如何在java中运行xjc -nv

问题描述

我有一个相当大的.xsd。我在使用 xjc 创建类时遇到了问题。发生以下错误:

[ERROR] Current configuration of the parser doesn't allow a maxOccurs attribute value to be set greater than the value 5,000.

我使用 xjc -nv 做了一个解决方法。

我目前正在尝试通过 maven 创建 java 类。

<build>
<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>2.2</version>
    <executions>
      <execution>
        <id>xjc</id>
        <goals>
          <goal>xjc</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <!-- The package of your generated sources -->
    </configuration>
  </plugin>
</plugins>

每当我编译项目时,都会出现错误。

有没有办法让 maven 也使用 -nv 参数?

标签: javamavenjaxbpom.xmlxjc

解决方案


所以解决方案就在我眼前。你只需要添加

<arguments>-nv</arguments>

到 pom.xml 里面的配置。


推荐阅读