Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
maven-jaxb2-plugin:如何在pom.xml中完成这个xjc命令行?_Maven_Jaxb_Xjc_Maven Jaxb2 Plugin - Fatal编程技术网

maven-jaxb2-plugin:如何在pom.xml中完成这个xjc命令行?

maven-jaxb2-plugin:如何在pom.xml中完成这个xjc命令行?,maven,jaxb,xjc,maven-jaxb2-plugin,Maven,Jaxb,Xjc,Maven Jaxb2 Plugin,由于需要编译XSD的各种问题(在其他SO文章中描述),我有一个绑定文件和一个本地扩展模式。下面的命令行工作正常,但我很难找到正确的pom.xml配置来模拟这一点: xjc -nv src/main/resources/TCIP_4_0_0_Final.xsd src/main/resources/local/ObaCcLocationReport.xsd -b src/main/resources/local/rename.xjb -d target 主要是,如何指定多个XSD?我试过: &l

由于需要编译XSD的各种问题(在其他SO文章中描述),我有一个绑定文件和一个本地扩展模式。下面的命令行工作正常,但我很难找到正确的
pom.xml
配置来模拟这一点:

xjc -nv src/main/resources/TCIP_4_0_0_Final.xsd src/main/resources/local/ObaCcLocationReport.xsd -b src/main/resources/local/rename.xjb -d target
主要是,如何指定多个XSD?我试过:

<schemaDirectory>src/main/resources</schemaDirectory>
<schemaIncludes>
  <include>TCIP_4_0_0_Final.xsd</include>
  <include>local/ObaCcLocationReport.xsd</include>
</schemaIncludes>
没有成功。建议

编辑

这是一个解决办法,但并不理想:

由于
obaclocationreport.xsd
依赖于作为
TCIP_4_0_0_Final.xsd
一部分编译的模式,因此我只需确保它在编译之后得到编译,并且它似乎按照文件路径顺序处理文件。因此,我将
obaclocationreport.xsd
放入
x
子文件夹,并将
pom.xml
更改为:

<schemaDirectory>src/main/resources</schemaDirectory>
<schemaIncludes>
  <include>TCIP_4_0_0_Final.xsd</include>
  <include>x/ObaCcLocationReport.xsd</include>
</schemaIncludes>
src/main/resources
TCIP_4_0_0_Final.xsd
x/obacclositionreport.xsd

这就正确地编译了模式并生成了Java文件。

免责声明:我是本文的作者

那么编译取决于XJC命令中模式文件的顺序?嗯,很有趣。为什么?

在这种情况下,请发布
mvn-xclean生成源代码
log

Maven似乎并没有像我得到的那样维护文件模式的顺序:

schemas=[file:/.../src/main/resources/local/ObaCcLocationReport.xsd,
         file:/.../src/main/resources/TCIP_4_0_0_Final.xsd]
这不是你想要的。请把它修好。(我依赖于这里的一个Maven库,但可以用不同的方法来维持秩序。)

您可以按如下方式对其进行配置:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
        <execution>
            <id>generate</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <strict>false</strict>
                <schemaIncludes/>
                <schemas>
                    <schema>
                        <fileset>
                            <includes>
                                <include>TCIP_4_0_0_Final.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                    <schema>
                        <fileset>
                            <includes>
                                <include>local/ObaCcLocationReport.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                </schemas>
            </configuration>
        </execution>
    </executions>
</plugin>
注:

  • 不要忘记
    ,否则默认情况下将包括
    src/main/resources/*.xsd
  • false
    为您提供
    -nv
  • 您始终可以使用
    args
    /
    arg
    在较低级别上配置
    xjc
    ,但我不推荐这样做

免责声明:我是本文的作者

那么编译取决于XJC命令中模式文件的顺序?嗯,很有趣。为什么?

在这种情况下,请发布
mvn-xclean生成源代码
log

Maven似乎并没有像我得到的那样维护文件模式的顺序:

schemas=[file:/.../src/main/resources/local/ObaCcLocationReport.xsd,
         file:/.../src/main/resources/TCIP_4_0_0_Final.xsd]
这不是你想要的。请把它修好。(我依赖于这里的一个Maven库,但可以用不同的方法来维持秩序。)

您可以按如下方式对其进行配置:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
        <execution>
            <id>generate</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <strict>false</strict>
                <schemaIncludes/>
                <schemas>
                    <schema>
                        <fileset>
                            <includes>
                                <include>TCIP_4_0_0_Final.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                    <schema>
                        <fileset>
                            <includes>
                                <include>local/ObaCcLocationReport.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                </schemas>
            </configuration>
        </execution>
    </executions>
</plugin>
注:

  • 不要忘记
    ,否则默认情况下将包括
    src/main/resources/*.xsd
  • false
    为您提供
    -nv
  • 您始终可以使用
    args
    /
    arg
    在较低级别上配置
    xjc
    ,但我不推荐这样做

免责声明:我是本文的作者

那么编译取决于XJC命令中模式文件的顺序?嗯,很有趣。为什么?

在这种情况下,请发布
mvn-xclean生成源代码
log

Maven似乎并没有像我得到的那样维护文件模式的顺序:

schemas=[file:/.../src/main/resources/local/ObaCcLocationReport.xsd,
         file:/.../src/main/resources/TCIP_4_0_0_Final.xsd]
这不是你想要的。请把它修好。(我依赖于这里的一个Maven库,但可以用不同的方法来维持秩序。)

您可以按如下方式对其进行配置:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
        <execution>
            <id>generate</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <strict>false</strict>
                <schemaIncludes/>
                <schemas>
                    <schema>
                        <fileset>
                            <includes>
                                <include>TCIP_4_0_0_Final.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                    <schema>
                        <fileset>
                            <includes>
                                <include>local/ObaCcLocationReport.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                </schemas>
            </configuration>
        </execution>
    </executions>
</plugin>
注:

  • 不要忘记
    ,否则默认情况下将包括
    src/main/resources/*.xsd
  • false
    为您提供
    -nv
  • 您始终可以使用
    args
    /
    arg
    在较低级别上配置
    xjc
    ,但我不推荐这样做

免责声明:我是本文的作者

那么编译取决于XJC命令中模式文件的顺序?嗯,很有趣。为什么?

在这种情况下,请发布
mvn-xclean生成源代码
log

Maven似乎并没有像我得到的那样维护文件模式的顺序:

schemas=[file:/.../src/main/resources/local/ObaCcLocationReport.xsd,
         file:/.../src/main/resources/TCIP_4_0_0_Final.xsd]
这不是你想要的。请把它修好。(我依赖于这里的一个Maven库,但可以用不同的方法来维持秩序。)

您可以按如下方式对其进行配置:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
        <execution>
            <id>generate</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <strict>false</strict>
                <schemaIncludes/>
                <schemas>
                    <schema>
                        <fileset>
                            <includes>
                                <include>TCIP_4_0_0_Final.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                    <schema>
                        <fileset>
                            <includes>
                                <include>local/ObaCcLocationReport.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                </schemas>
            </configuration>
        </execution>
    </executions>
</plugin>
注:

  • 不要忘记
    ,否则默认情况下将包括
    src/main/resources/*.xsd
  • false
    为您提供
    -nv
  • 您始终可以使用
    args
    /
    arg
    在较低级别上配置
    xjc
    ,但我不推荐这样做

不,对不起,我不清楚:它似乎是按文件系统顺序处理它们,而忽略了它们在
pom.xml
中的显示顺序。我将尝试完全独立的
元素,谢谢。不,对不起,我不清楚:它似乎是按文件系统顺序处理它们,而忽略了它们在
pom.xml
中的显示顺序。我将尝试完全独立的
元素,谢谢。不,对不起,我不清楚:它似乎是按文件系统顺序处理它们,而忽略了它们在
pom.xml
中的显示顺序。我将尝试完全独立的
元素,谢谢。不,对不起,我不清楚:它似乎是按文件系统顺序处理它们,而忽略了它们在
pom.xml
中的显示顺序。我将尝试完全独立的
元素,谢谢。