我正在开发一个应用程序,该应用程序在 XSD 文件中有许多 maxOccurs="unbounded" ,例如
<xs:element name="bar" maxOccurs="unbounded" />
和
<xsd:choice maxOccurs="unbounded">
我了解到这实际上是一个使其不受限制的漏洞,我将其首先更改为“4095”,然后更改为“100”,并且在运行 mvn clean install 时,两者都抛出以下错误
[INFO] --- jaxb2:0.12.3:generate (default)
[INFO] Up-to-date check for source resources [[file: filesnames..... ]]
[INFO] Sources are not up-to-date, XJC will be executed.
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate (default) on project projectName: Unable to parse input schema(s). Error messages should have been provided. -> [Help 1]
如何解决这个问题? maxOccurences 中可以使用的最大数量是多少?
过去,我在使用 maven-jaxb2-plugin 时也遇到过严重的问题,这一次又一次令人沮丧,因为我找不到极其有用的 Maven 插件文档。
从这些天开始,我就使用 org.codehaus.mojo:jaxb2-maven-plugin。
如果您不想切换到 jaxb2-maven-plugin,您至少应该考虑使用较新版本的插件。 0.15.3 版本对我有用。
一些注意事项: