Example usage:

    <project ...>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.carlspring.maven</groupId>
                    <artifactId>derby-maven-plugin</artifactId>
                    <version>${version.derby.plugin}</version>

                    <configuration>
                        <!-- Optional, defaults to ${project.build.directory}/derby-->
                        <derbyHome>${project.build.directory}/derby</derbyHome>
                        <!-- Optional, defaults to 1527 -->
                        <port>1527</port>
                        <!-- Optional, the username to use when authenticating.-->
                        <username>derby</username>
                        <!-- Optional, the password to use when authenticating.-->
                        <password>derby</password>
                        <!-- Optional, the absolute class name of the driver.-->
                        <!--<driver></driver>-->
                        <!-- Optional, the URL to use when connecting.-->
                        <!--<connectionURL></connectionURL>-->
                        <!-- Optional, the URL to use when shutting down the database.-->
                        <connectionURLShutdown>jdbc:derby:;shutdown=true</connectionURLShutdown>
                        <!-- Optional, whether to run Derby with debugging statements.-->
                        <debugStatements>true</debugStatements>
                        <!-- Whether to bypass running Derby.-->
                        <skip>false</skip>
                    </configuration>

                    <executions>
                        <execution>
                            <id>start-derby</id>
                            <phase>test-compile</phase>
                            <goals>
                                <goal>start</goal>
                            </goals>

                        </execution>
                    </executions>

                </plugin>
            </plugins>
        </build>
    </project>

Usage of the run goal, configure the plugin outside of the "execution" scope as outlined above:

    <project ...>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.carlspring.maven</groupId>
                    <artifactId>derby-maven-plugin</artifactId>
                    <version>${version.derby.plugin}</version>
                    <configuration>
                        <basedir>${project.build.directory}/derby</basedir>
                        <port>1527</port>
                    </configuration>
                    <executions>
                        <execution>
                            <id>start-derby</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>start</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>stop-derby</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </project>

    # mvn derby:run
    Will start your derby instance on port 1527 and block until you CTRL-C the process or use:

    # mvn derby:stop
    Sends a stop message to the configured server instance.

The maven property derby.skip, if set to true, will prevent the plugin from launching derby. It can also be set with
    <plugin>
        <groupId>org.carlspring.maven</groupId>
        <artifactId>derby-maven-plugin</artifactId>
        <version>${version.derby.plugin}</version>
        <configuration>
            <skip>true</skip>
        </configuration>
        ...
     </plugin>
