I switched to Netbeans probably a month or so ago for this small side project I’ve started and so far I’m digging it. However I hit a little issue that Eclipse never had a problem with. I’m using DbUnit for integration tests and I have an AbstractDbUnitIntegrationTest class that does a CLEAN_INSERT on the database for every test, which is great. But that means I need to have a data set to start with.
To accomplish this, I’ve written a small DbUnitUtil class that exports all (or some) tables from my database to /src/test/resources/data.xml where that abstract class then loads from. I’ve already written this class for another project I did last year so it’s easy enough to use, however, if you have a class in /src/test/java/, Netbeans automatically assumes it’s a unit test and tries to run with with ‘mvn test’. This class has a static void main method and should be run as such, but I cannot figure out how to get Netbeans to recognize that with the current root directory being test.
So to resolve this issue, which only occurs when I want to export a data set, I have to move this class to /src/main/java, where it doesn’t really belong, and maven realizes it has a static main void and runs it as expected. I’ve tried the DbUnit maven plugin but it seems to have a bug in it when specifying where to actually export the data file to, it just ignore it and uses the default.