gpt4 book ai didi

java - 阻止 JaxB 使用 maven 在剧集中生成文件

转载 作者:行者123 更新时间:2023-12-01 06:10:02 25 4
gpt4 key购买 nike

我正在创建的此服务中有 4 个模块。有上传、关联、阅读和常用。前 3 个模块每个都有自己的 wsdls,它们在公共(public)模块中导入一个公共(public) xsd。我让 common 为 common xsd 生成一个插曲,但是每个模块仍然生成相同的文件,所以我最终得到了 common xsd 中定义的每个文件的 4 个。

这是我在普通 pom 中的内容

        <plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<id>efolder-model</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<episode>true</episode>
<schemaDirectory>src/main/resources/schemas/efolder</schemaDirectory>
<schemaIncludes>
<include>**/*.xsd</include>
</schemaIncludes>
<args>

</args>
<extension>true</extension>
<strict>false</strict>
<!-- breaks with schema imports -->
</configuration>
</execution>
</executions>
</plugin>

这是来自其他模块之一的pom(它们基本相同,只是指不同的wsdls)
        <plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<id>cdm-model</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>${project.build.directory}/classes/schemas</schemaDirectory>
<schemaIncludes>
<include>schemas/cdm/claim/*.xsd,/cdm/common/*.xsd,/cdm/document/*.xsd,/cdm/participant/*.xsd</include>
</schemaIncludes>

<bindingDirectory>${project.build.directory}/classes/schemas</bindingDirectory>
<bindingIncludes>
<bindingInclude>/cdm/mappings.xjb,/cdm/mappings-participant-v4.xsd</bindingInclude>
</bindingIncludes>
<bindings>
<binding>
<dependencyResource>
<groupId>${project.groupId}</groupId>
<artifactId>efolder-svc-web-common</artifactId>
</dependencyResource>
</binding>
</bindings>

<extension>true</extension>
<strict>false</strict>
</configuration>
</execution>
</executions>
</plugin>

我也试过
                        <configuration>
<episodes>
<episode>
<groupId>${project.groupId}</groupId>
<artifactId>efolder-svc-web-common</artifactId>
</episode>
</episodes>
<schemaDirectory>${project.build.directory}/classes/schemas</schemaDirectory>
<schemaIncludes>
<include>schemas/cdm/claim/*.xsd,/cdm/common/*.xsd,/cdm/document/*.xsd,/cdm/participant/*.xsd</include>
</schemaIncludes>

<bindingDirectory>${project.build.directory}/classes/schemas</bindingDirectory>
<bindingIncludes>
<bindingInclude>/cdm/mappings.xjb,/cdm/mappings-participant-v4.xsd</bindingInclude>
</bindingIncludes>

<extension>true</extension>
<strict>false</strict>
</configuration>

但无论哪种方式,我仍然会在每个模块的 generated-sources/xjc/.../efolder/service/common 中生成文件。在常见的情况下,我也有 xjc/META-INF/sun-jaxb.episode,即:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" if-exists="true" version="2.1">
<!--

This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2016.04.15 at 09:56:57 AM EDT

-->
<bindings xmlns:tns="http://service.efolder.url/common" if-exists="true" scd="x-schema::tns">
<schemaBindings map="false">
<package name="url.efolder.service.common"/>
</schemaBindings>
<bindings if-exists="true" scd="~tns:EFolderFault">
<class ref="url.efolder.service.common.EFolderFault"/>
</bindings>
<bindings if-exists="true" scd="tns:VersionNotFoundFault">
<class ref="url.efolder.service.common.VersionNotFoundFault"/>
</bindings>
<bindings if-exists="true" scd="tns:InvalidDocTypeFault">
<class ref="url.efolder.service.common.InvalidDocTypeFault"/>
</bindings>
<bindings if-exists="true" scd="tns:ClaimNotFoundFault">
<class ref="url.efolder.service.common.ClaimNotFoundFault"/>
</bindings>
<bindings if-exists="true" scd="tns:InvalidClaimFault">
<class ref="url.efolder.service.common.InvalidClaimFault"/>
</bindings>
<bindings if-exists="true" scd="tns:InvalidDocCategoryFault">
<class ref="url.efolder.service.common.InvalidDocCategoryFault"/>
</bindings>
<bindings if-exists="true" scd="tns:SeriesNotFoundFault">
<class ref="url.efolder.service.common.SeriesNotFoundFault"/>
</bindings>
<bindings if-exists="true" scd="~tns:eFolderFaultCategory">
<typesafeEnumClass ref="url.efolder.service.common.EFolderFaultCategory"/>
</bindings>
</bindings>
</bindings>

关于为什么它仍在生成的任何想法?谢谢

最佳答案

如果你想避免默认(剧集文件),只需添加一个名为 的空元素剧集文件 到你的插件的配置。这对我来说与 maven-jaxb2-plugin (0.12.1.0) 相关:

                <configuration>
...
<episodeFile/>
...
</configuration>

关于java - 阻止 JaxB 使用 maven 在剧集中生成文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36650558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com