java - How run Embedded mysql server via maven? -


is there way run lightweight mysql during maven integration tests? have found libmysqld, seems launched inside client application. may there way or wrapper run litle server? or other ways/implementation run lightweight mysql server?

note

there mysql-je library, looks old (2006).

as @hotzst mentioned, embedded database h2 or hsqldb helpful.

but if have , use https://github.com/rhuss/docker-maven-plugin start piece of software within maven build process.

the precondition working docker or docker-machine installation on machine.

i use following code snippet start mongodb while doing integration test

<plugin>      <groupid>org.jolokia</groupid>     <artifactid>docker-maven-plugin</artifactid>     <version>0.13.7</version>      <configuration>                                          <logdate>default</logdate>         <autopull>true</autopull>         <images>             <image>                 <alias>mysql</alias>                 <name>mysql:5.7.10</name>                 <run>                     <ports>                         <port>3306:3306</port>                     </ports>                     <log>                         <prefix>mongo</prefix>                         <color>yellow</color>                     </log>                 </run>             </image>         </images>     </configuration>      <executions>         <execution>             <id>start</id>             <phase>pre-integration-test</phase>             <goals>                 <goal>build</goal>                 <goal>start</goal>             </goals>         </execution>         <execution>             <id>stop</id>             <phase>post-integration-test</phase>             <goals>                 <goal>stop</goal>             </goals>         </execution>      </executions> </plugin> 

you can start integration tests , according maven phases mvn:verify. first time run plugin may take while.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -