我正在尝试使用Java 8构建Confluence插件。它使用Java 7正确构建。它使用jaxb2-maven-plugin,其中一个定义的执行目标为“schemagen”,阶段为“generate-resources”抛出这个错误:
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:schemagen (restTypes) on project bb-team-plugin:
Execution restTypes of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:schemagen failed:
syntax error @[1,1] in file: MY_WORKDIR/target/generated-sources/jaxb/META-INF/sun-jaxb.episode -> [Help 1]
我有绑定文件:
<jxb:bindings jxb:version="1.0" jxb:extensionBindingPrefixes="xjc"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
<jxb:globalBindings>
<xjc:simple />
</jxb:globalBindings>
</jxb:bindings>
在maven中使用-e或-X不会抛出任何额外的有用输出,在执行配置中使用会抛出SAXParseException警告并出现与上述相同的错误。
我将sun-jaxb.episode与其他示例(如此网站https://github.com/highsource/maven-jaxb2-plugin/wiki/Using-Episodes)进行了比较,并且它具有完全相同的结构,没有任何内容看起来格格不入。
知道会发生什么事吗?
答案 0 :(得分:0)
这可能有点太晚或者不完全符合您的要求,但这可能会对某些人有所帮助。
当我尝试使用JAXB2从带注释的类生成XSD时,我在项目中遇到了相同的语法错误(“文件中的语法错误@ [1,1]:”)。我相信插件也在查看我的xsd文件,因此抛出了SAXParseException,所以我在pom.xml中包含了一个排除过滤器,如下所示:
<schemaSourceExcludeFilters>
<myExcludes implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
<patterns>
<pattern>\.xsd</pattern>
</patterns>
</myExcludes>
</schemaSourceExcludeFilters>
更多内容:http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/schemagen-mojo.html
这对我有用。我之前尝试的另一件事是从文件路径中删除空格(我的项目名称有空格),因为这似乎生成了一个尚未修复的旧错误。关于此问题,请查看:https://github.com/mojohaus/jaxb2-maven-plugin/issues/48
希望它有所帮助!