【问题标题】:How to handle multiple src files in dbunit-maven-plugin如何在 dbunit-maven-plugin 中处理多个 src 文件
【发布时间】:2010-01-28 09:15:29
【问题描述】:

dbunit-maven-plugin 1.0-SNAPSHOT 版本支持在sources标签下表达多个src文件,你如何在仅支持单个src标签的1.0-beta-3版本上做同样的事情

             <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>dbunit-maven-plugin</artifactId>
                <version>${dbunit-maven-plugin.version}</version>

                <executions>
                    <execution>
                        <id>populate sample data</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>operation</goal>
                        </goals>
                        <configuration>
                            <format>flat</format>
                            <sources>
                                <source>src/main/resources/seeddata.xml</source>
                                <source>src/test/resources/testdata.xml</source>
                            </sources>
                            <skip>${db.dataset.skip}</skip>
                        </configuration>
                    </execution>
                </executions>
           </plugin>

【问题讨论】:

    标签: maven-2 dbunit


    【解决方案1】:

    这一改进归功于MBUNIT-3,它确实落后于 1.0-beta-3 的发布。因此,如果您想要此功能,请使用 1.0-SNAPSHOT 或自己在 1.0-beta-3 分支上应用 r10226 中的更改(获取 diffs 的补丁,应用它并编译您的 1.0-beta3 版本-补丁)。

    但老实说,我真的不明白你为什么不使用 1.0-SNAPSHOT。如果使用 SNAPSHOT 有问题,只需构建具有固定版本号的版本即可。

    更新:令人惊讶的是,dbunit-maven-plugin 的 SNAPSHOT 版本似乎未在 codehaus snapshot repository 中发布。因此,您必须检查源代码并自己构建才能使用它。为此,请运行以下命令:

    svn checkout http://svn.codehaus.org/mojo/trunk/mojo/dbunit-maven-plugin/ dbunit-maven-plugin
    cd dbunit-maven-plugin
    mvn install
    

    插件在快照存储库中不可用真的很奇怪,我 100% 确定它曾经是。

    【讨论】:

    【解决方案2】:

    目前,我只是解决了这个问题,让多个执行块来解决这个问题。不确定,如果有更好的方法来解决这个问题

    【讨论】:

      【解决方案3】:

      使用 Pascal Thivent 给出的说明从源代码构建 1.0-SNAPSHOT 版本后,我能够使用多个源文件选项。这帮助我节省了多次写作 执行块。

      谢谢帕斯卡!

      代码如下:

       <executions>
         <execution>
         <id>Common</id>
         <phase>process-test-resources</phase>
         <goals>
             <goal>operation</goal>
          </goals>
          <configuration>
             <format>flat</format>
             <verbose>2</verbose>
             <sources>
                 <source>first.xml</source>
                 <source>second.xml</source>
             </sources>
             <skip>${maven.test.skip}</skip>
          </configuration>
          </execution>
      </executions>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-07-23
        • 2012-08-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-07-28
        • 1970-01-01
        相关资源
        最近更新 更多