java - sql-maven-plugin: clean multiple databases? -
i clean , fill 2 different databases integration testing maven project. use sql-maven-plugin, wasn't able make handle different databases (i can have 1 plugin declaration sql-maven-plugin, , configuration shared between executions).
how guys solve that? there workaround solve issue?
thanks in advance!
you can define of configuration within each individual execution section , configure required. instead of having shared configuration.
so here example connect 2 different hsqldb databases:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>sql-maven-plugin</artifactid> <version>1.5</version> <dependencies> <dependency> <groupid>org.hsqldb</groupid> <artifactid>hsqldb</artifactid> <version>2.2.9</version> </dependency> <!-- add dependencies other database drivers here --> </dependencies> <executions> <!-- execution against database 1 --> <execution> <id>database1</id> <phase>process-test-resources</phase> <goals> <goal>execute</goal> </goals> <!-- specific configuration execution against database1 --> <configuration> <driver>org.hsqldb.jdbcdriver</driver> <url>jdbc:hsqldb:hsql://localhost:9999/database1</url> <username>sa</username> <password></password> <sqlcommand>select count(type_name) information_schema.system_tables</sqlcommand> </configuration> </execution> <!-- execution against database 2 --> <execution> <id>database2</id> <phase>process-test-resources</phase> <goals> <goal>execute</goal> </goals> <!-- specific configuration execution against database2 --> <configuration> <driver>org.hsqldb.jdbcdriver</driver> <url>jdbc:hsqldb:hsql://localhost:8888/database2</url> <username>sa</username> <password></password> <sqlcommand>select count(type_name) information_schema.system_tables</sqlcommand> </configuration> </execution> </executions> </plugin>
Comments
Post a Comment