tags:

views:

406

answers:

3

dbunit-maven-plugin 1.0-SNAPSHOT release supported expressing multiple src files under sources tag, how do you do the same on 1.0-beta-3 version which supports only a single src tag

             <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>
+1  A: 

For the time being, I just worked around the problem to have multiple execution blocks to solve the issue. Not sure, if there is a better way to solve this issue

Joshua
+1  A: 

This improvement is due to MBUNIT-3 which is indeed posterior to the release of 1.0-beta-3. So if you want this feature, either use the 1.0-SNAPSHOT or apply the change in r10226 yourself on the 1.0-beta-3 branch (get the patch for the diffs, apply it and compile your version of 1.0-beta3-patched).

But to be honest, I don't really get why you don't use 1.0-SNAPSHOT. If using a SNAPSHOT is a problem, just build a version with a fixed version number.

Update: Surprisingly, it appears that the SNAPSHOT version of the dbunit-maven-plugin is not published in the codehaus snapshot repository. So, you'll have to checkout the sources and build it yourself to use it. To do so, run the following commands:

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

It is really strange that the plugin is not available in the snapshot repository, I'm 100% sure it used to be.

Pascal Thivent
I couldn't locate the 1.0-SNAPSHOT release from the codehaus repository, hence I had to revert my changes back to the 1.0-beta-3 release. (Note: I am also assuming that 1.0-SNAPSHOT to be the latest release compared to 1.0-beta-3)
Joshua
@Joshua oh, indeed, the snapshot repository doesn't have it at http://snapshots.repository.codehaus.org/org/codehaus/mojo/. You'll need to checkout the sources from http://mojo.codehaus.org/dbunit-maven-plugin/source-repository.html and to install yourself (and yes, the 1.0-SNAPSHOT is the ultimate version until the final 1.0 release)
Pascal Thivent
A: 

I was able to use multiple source file option after building 1.0-SNAPSHOT version from the sources using instructions given by Pascal Thivent. This helped me to save writing multiple execution blocks.

Thanks Pascal!.

Here is the code:

 <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>
moorsu
will give this a try
Joshua