3

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>
4

3 回答 3

3

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

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

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

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

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

于 2010-01-28T10:04:44.140 回答
1

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

于 2010-01-28T09:43:31.877 回答
1

在使用 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>
于 2010-07-07T07:07:11.743 回答