xml - 如何使 maven-jaxb2-plugin 忽略生成类(如果它已存在于我的项目源中)

标签 xml maven xsd maven-jaxb2-plugin

我正在使用 maven jaxb2 插件从 xsd 生成 java 类。我有一个要求,如果类已经存在于我的源中,它不应该生成类。

Is there anyway can we configure to ignore the pojo generation if it is already exist.

例子:

客户类已经存在于我的源代码中,我不想再次重新生成,因此即使我们处理 customer.xsd 插件也应该忽略它
<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
             <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
         <version>0.12.1</version>
         <executions>
         <execution>
         <goals>
         <goal>generate</goal>
         </goals>
         </execution>
         </executions>
         <configuration>
         <schemaDirectory>${project.basedir}/src/main/resources/xsd</schemaDirectory>
  <!--          <generatePackage>com.test</generatePackage>
        <generateDirectory>${project.build.directory}/src/main/java</generateDirectory> -->


    enter code here

         <schemaIncludes>
         <include>*.xsd
         </include>
         </schemaIncludes>
         </configuration> 
            </plugin>
        </plugins>

最佳答案

这似乎是不可能实现的。

取自插件的 Wiki页面,您可以控制“还有什么”(除了 pom.xml 等默认文件)控制您的文件是否已过期并需要重新编译,但您不能排除“最新的”中提到的任何默认文件-日期检查算法”。

关于xml - 如何使 maven-jaxb2-plugin 忽略生成类(如果它已存在于我的项目源中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42403541/

相关文章:

.net - 在 C# 中验证 XSD,就好像它是 XML : doesn't give expected warnings

ruby-on-rails - 如何在 REST XML Web 服务中表示可变偏移时区?

java - 启动 Tomcat 时 Web 模块没有从核心模块中找到类

javascript - XSD 正则表达式 : empty string OR something else

java - 从 xsd 生成 maven-jaxb2-plugin 类(版本错误)

java - 通过 proguard 为模块中缩小的类创建源 jar

xml - XSD:如何描述一个元素,使其没有值?

c# - 编码 xml 并保存到 SQL Server

css - 如何更改现有 OpenERP7 表单 View 的字段宽度(使用百分比,无像素)?

java - java中的XML解析: ignore tags as value