Maven 2 如何在dbunitmaven插件中处理多个src文件

Maven 2 如何在dbunitmaven插件中处理多个src文件,maven-2,dbunit,Maven 2,Dbunit,dbunit maven plugin 1.0-SNAPSHOT发行版支持在sources标记下表达多个src文件,如何在仅支持单个src标记的1.0-beta-3版本上实现同样的操作 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dbunit-maven-plugin</artifa

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>

org.codehaus.mojo
DbUnitMaven插件
${dbunit maven plugin.version}
填充样本数据
过程测试资源
活动
平的
src/main/resources/seeddata.xml
src/test/resources/testdata.xml
${db.dataset.skip}

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

这个改进是因为它确实是在1.0-beta-3发布之后出现的。因此,如果您想要此功能,可以使用1.0-SNAPSHOT或在1.0-beta-3分支上应用您自己的更改(获取补丁,应用它并编译您的1.0-beta3-patched版本)

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

更新:令人惊讶的是,dbunit maven插件的快照版本似乎没有在中发布。因此,您必须签出源代码并自行构建以使用它。为此,请运行以下命令:

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

非常奇怪的是,该插件在快照存储库中不可用,我100%确定它以前是可用的。

在使用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>

普通的
过程测试资源
活动
平的
2.
first.xml
second.xml
${maven.test.skip}

我无法从codehaus存储库中找到1.0-SNAPSHOT版本,因此我必须将更改恢复到1.0-beta-3版本。(注意:我还假设1.0-SNAPSHOT是最新的版本,而不是1.0-beta-3)@Joshua-oh,的确,快照存储库中没有它。您需要从中签出源代码并自行安装(是的,1.0-SNAPSHOT是最终版本,直到最终1.0版本)