【问题标题】:jibx-maven-plugin 1.2.5 schema-codegen goal <schemaBindingDirectory> value ignoredjibx-maven-plugin 1.2.5 schema-codegen 目标 <schemaBindingDirectory> 值被忽略
【发布时间】:2020-09-30 02:27:27
【问题描述】:

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

这是我当前的 pom.xml 文件,我在其中修改了 &lt;schemaBindingDirectory&gt; 的值,但目标路径未更改。

<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 文件中是否还有其他错误? 有人可以帮助我改变路径吗? 提前感谢您的帮助。

【问题讨论】:

    标签: maven jibx


    【解决方案1】:

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

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

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-22
      • 2021-04-26
      • 1970-01-01
      • 2014-07-17
      • 2020-08-30
      • 1970-01-01
      相关资源
      最近更新 更多