首页 > 解决方案 > jibx-maven-plugin 1.2.5 schema-codegen 目标忽略值

问题描述

我想将生成的类存储在 src/main/java 目录中,但由于 jibx-maven-plugin .java 文件的默认设置会转到目标/生成源。

这是我当前的pom.xml文件,我在其中修改了 的值,<schemaBindingDirectory>但目标路径没有更改。

<build>
    <pluginManagement>
        <plugins>
            <plugin>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-maven-plugin</artifactId>
            <version>1.2.5</version>
                 <executions>
                      <execution>
                      <id>generate-java-code-from-schema</id>
                             <goals>
                             <goal>schema-codegen</goal>
                             </goals>
                             <configuration>
                             <schemaLocation>src/main/config</schemaLocation>
                             <includeSchemas>
                             <includeSchema>example1.xsd</includeSchema>
                             </includeSchemas>
                             <options>
                             <package>com.poc.jibx</package>
                             </options>
                             </configuration>
                      </execution>

                      <execution>
                            <id>compile-binding</id>
                            <goals>
                            <goal>bind</goal>
                            </goals>
                            <configuration>
                            <schemaBindingDirectory>src/main/java</schemaBindingDirectory>
                            <load>true</load>
                            <validate>true</validate>
                            <!--<verbose>true</verbose>-->
                            <verify>true</verify>
                            </configuration>
                       </execution>  

                       <execution>
                            <id>bind-xml</id>
                            <goals>
                            <goal>bind</goal>
                            </goals>
                       </execution>                                 
                </executions>
         </plugin>


         <plugin>
             <groupId>org.jibx.config</groupId>
             <artifactId>maven-plugin-reactor</artifactId>
             <version>1.3.4-SNAPSHOT</version>
         </plugin>

      </plugins>
   </pluginManagement>
</build>

build.xml 文件中是否需要进行任何更改?pom.xml 文件中是否还有其他错误?有人可以帮我改变路径吗?提前感谢您的帮助。

标签: mavenjibx

解决方案


如果要在 src/main/java 中创建生成的 java 文件,请包括:

                            <schemaBindingDirectory>src/main/java</schemaBindingDirectory>

在 schemaLocation 标记之前的绑定配置中。

JiBX 文档中不包含此标记,因为通常您不希望生成的文件包含在源路径中。

我们强烈建议您使用默认文件位置,以免意外提交任何生成的文件。


推荐阅读