org.codehaus.mojo.jaxb2-maven-plugin:在pom中使用多个源时忽略绑定设置

时间:2017-11-28 09:11:08

标签: maven jaxb jaxb2-maven-plugin

为代码生成定义了多个源xsd,它似乎是源路径的长度限制。如果我删除注释以添加源标记,代码生成会抱怨枚举常量太多而失败。为了解决这个问题,我之前在binding.xjb中添加了typesafeEnumMaxMembers =“2000”。就像指定多个源或路径变长时忽略绑定设置。具有较小源标记的代码生成按预期工作。

有什么建议吗?

片段:

<configuration>
          <xjbSources>
            <xjbSource>src/main/xjb/binding.xjb</xjbSource>
          </xjbSources>
          <sources>
            <source>src/main/resources/xsd/Bausparmodellrechner/2017/2/berechneTAModell/Anfrage.xsd</source>
            <source>src/main/resources/xsd/Bausparmodellrechner/2017/2/berechneTAModell/Antwort.xsd</source>
            <source>src/main/resources/xsd/Bausparmodellrechner/2017/2/druckeTAModell/Anfrage.xsd</source>
            <source>src/main/resources/xsd/Bausparmodellrechner/2017/2/druckeTAModell/Antwort.xsd</source>
            <source>src/main/resources/xsd/is-konditionen/1.0/GibDarlehenskonditionenAntwort.xsd</source>
            <source>src/main/resources/xsd/sv/sv.xsd</source>
            <source>src/main/resources/xsd/Bausparantrag/2017/1/pruefeAntrag/Anfrage.xsd</source>
            <source>src/main/resources/xsd/Bausparantrag/2017/1/pruefeAntrag/Antwort.xsd</source>
<!--             <source>src/main/resources/xsd/Bausparantrag/2017/1/druckeAntrag/Anfrage.xsd</source> -->
            <source>src/main/resources/xsd/Bausparantrag/2017/1/verarbeiteAntrag/Anfrage.xsd</source>
<!--             <source>src/main/resources/xsd/Bausparantrag/2017/1/verarbeiteAntrag/Antwort.xsd</source> -->
          </sources>
        </configuration>

binding.xjb:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jxb:bindings version="2.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    jxb:extensionBindingPrefixes="xjc">

    <!-- Raise theEnumMemberSizeCap limit -->
    <jxb:globalBindings typesafeEnumMaxMembers="2000">
    </jxb:globalBindings>

</jxb:bindings>

1 个答案:

答案 0 :(得分:0)

在xsd文件中找到使用内联绑定的解决方法:

SELECT
  AVG(CASE year >1950 THEN star END) - AVG(CASE year < 1950 THEN star END),
  AVG(star)
FROM Rating
GROUP BY title

另一个选择是从

移动整个项目

<?xml version="1.0" encoding="ISO-8859-1"?> <xsd:schema ... xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.0"> <xsd:annotation> <xsd:appinfo> <jxb:globalBindings typesafeEnumMaxMembers="2000" /> </xsd:appinfo> </xsd:annotation> .... </xsd:schema>

到较短的基本路径,如

/Users/myuser/Documents/build/myproject