Starting an H2 Database Server from Maven?

后端 未结 9 1805
不思量自难忘°
不思量自难忘° 2021-01-30 07:09

Suppose I want to create and use an H2 database for my integration tests.

Maven has a command to run tests: mvn test.

Is there a way to tell maven t

9条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 07:45

    Since H2 doesn't provide Maven plugin you should start it using maven-antrun-plugin. Write code for start and stop h2 engine in ant task and call it when your integration test starts and stop.

    See details on http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing

提交回复
热议问题