I am using sql-maven-plugin to setup a in memory hsql database for unit tests
<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.8</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>create-db</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<driver>org.hsqldb.jdbcDriver</driver>
<url>jdbc:hsqldb:mem:test;shutdown=false</url>
<username>SA</username>
<password></password>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>src/test/sql/test_db/test.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
</plugin>
in unit tests that run in maven:test phase, I instantiated a datasource with that url
org.hsqldb.jdbc.JDBCDataSource ds = new JDBCDataSource();
ds.setUrl(URL);
ds.setUser("sa");
ds.setPassword("");
but this does not have the tables that i had initialized via the scripts. it turns out surefire forks a new jvm and the original hsql instance started is not accessible from there. Is there a solution without introducing a file backed hsqldb ?
Thanks