Maven 和 XSD [错误] 无法执行目标 org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate (default): 无法解析输入模式

问题描述 投票:0回答:1

我正在开发一个应用程序,该应用程序在 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 中可以使用的最大数量是多少?

xml maven xsd jaxb maven-jaxb2-plugin
1个回答
0
投票

过去,我在使用 maven-jaxb2-plugin 时也遇到过严重的问题,这一次又一次令人沮丧,因为我找不到极其有用的 Maven 插件文档。

从这些天开始,我就使用 org.codehaus.mojo:jaxb2-maven-plugin

如果您不想切换到 jaxb2-maven-plugin,您至少应该考虑使用较新版本的插件。 0.15.3 版本对我有用。

一些注意事项:

  • 在 0.12.3 中,我需要向插件添加一些依赖项以使其正常工作,而在 0.15.3 中我必须将其删除。
  • 现在整个 javax 课程已转移到雅加达。因此,最新的插件版本可能不适合您。
© www.soinside.com 2019 - 2024. All rights reserved.