java-jaxb2 maven插件,在单独的标签中定义多个架构文件
作者:互联网
我正在使用maven jaxb2插件从xsd文件生成Java类.最近,我遇到了问题,我的模式文件列表变得很长,我将所有这些文件都记录在shemaFiles标记中,以逗号分隔,并且该行本身很长,我担心将来它会影响代码的可读性并错误原因.那么有没有什么解决方案可以将文件写入单独的标签中,例如:
<schemaFilesList>
<schemaFile>SharedResources/xsd/Common.xsd</schemaFile>
<schemaFile>SharedResources/xsd/Another.xsd</schemaFile>
....
</schemaFilesList>
这是我现在拥有的代码:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<extension>true</extension>
<schemaDirectory>target/xsd</schemaDirectory>
<!-- I have really long list of files here, in different directories-->
<schemaFiles>
SharedResources/xsd/Common.xsd,SharedResources/xsd/Messaging/EmailService.xsd, .....
</schemaFiles>
</configuration>
</execution>
</executions>
</plugin>
提前致谢.
解决方法:
我们也有很多模式.我们只是忽略了< schemaFiles>元素,并使其读取< schemaDirectory>中的所有架构.
标签:maven-jaxb2-plugin,jaxb2,maven-plugin,xsd,java 来源: https://codeday.me/bug/20191031/1972739.html