This is a maven plugin for for starting a embedded postgresql server. By default the server starts at the initialization stage and stops at the compile stage. Possible values in the configuration block:
- dbDir (optional, deprecated, dir actual) - file directory of the instance (if it will be empty then files will create in a terger directory);
- port (required; default 15432) - port on which the instance will be started;
- dbName (required, deprecated, name actual) - name of database witch will be created in the instance;
- schemas (required) - list of scheme witch will be created in the instance.
You can use this example to start the server during maven initialization lifecycle.
<plugin>
<groupId>dev.crashteam.maven.plugins</groupId>
<artifactId>pg-embedded-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<port>${db.port}</port>
<name>${db.name}</name>
<schemas>
<schema>${db.schema}</schema>
</schemas>
</configuration>
<executions>
<execution>
<id>PG_server_start</id>
<phase>initialize</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>PG_server_stop</id>
<phase>compile</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
Attention: extremely important to pay attention to the stages of launching plug-ins dependent on the launch of this plugin. For example, your migration like flyway it should run on phase initialize and your JOOQ should run on phase generate-sources