2

I want to use docker-maven-plugin to deploy PostgreSQL container and run some integration tests over it.

<plugin>
     <groupId>io.fabric8</groupId>
     <artifactId>docker-maven-plugin</artifactId>
     <version>0.20.0</version>
     <executions>
           <execution>
                <id>prepare-it-database</id>
                <phase>pre-integration-test</phase>
                <goals>
                     <goal>start</goal>
                </goals>
                <configuration>
                     <images>
                          <image>
                                <name>postgres:9.5.4</name>
                                <alias>it-database</alias>
                                <run>
                                    <ports>
                                        <port>it-database.port:5432</port>
                                    </ports>
                                    <wait>
                                        <log>database system is ready to accept connections</log>
                                            <time>20000</time>
                                    </wait>
                                </run>
                          </image>
                     </images>
                </configuration>
           </execution>
      </executions>
</plugin>

Is it possible to run another goal (mvn e.g. flyway:migrate) from this plugin?

Roald Nefs
  • 1,302
  • 10
  • 29
max.kuzmentsov
  • 766
  • 1
  • 10
  • 22

1 Answers1

0

No, this plugin does not execute other Maven plugins (and very few do that).

What you need to do is to bind d-m-p's start goal to pre-integration-test, and then also bind flyway plugin to pre-integration-test Maven phase.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277