<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.adangel.liquibase.ext</groupId>
    <artifactId>liquibase-percona</artifactId>
    <name>Liquibase Percona Extension</name>
    <version>1.3.0</version>
    <description>A Liquibase extension that makes use of the percona toolkit</description>
    <url>https://liquibase.jira.com/wiki/display/CONTRIB/Percona+Online+Schema+Change</url>

    <inceptionYear>2014</inceptionYear>
    <licenses>
        <license>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <name>Apache License, Version 2.0</name>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:http://github.com/adangel/liquibase-percona.git</connection>
        <url>https://github.com/adangel/liquibase-percona</url>
      <tag>liquibase-percona-1.3.0</tag>
  </scm>

    <developers>
        <developer>
            <id>adangel</id>
            <name>Andreas Dangel</name>
            <email>adangel at users.sourceforge.net</email>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>1.6</java.version>
        <liquibase.version>3.5.3</liquibase.version>
        <mysql.version>5.1.40</mysql.version>

        <config_host>127.0.0.1</config_host>
        <!--
        Docker will choose a random free port for the mysql instance
        and the docker-maven-plugin will store it in this property.
        If you want a fixed port, just define the property here.
        <config_port>3306</config_port>
         -->
        <config_user>root</config_user>
        <config_password>root</config_password>
        <config_dbname>testdb</config_dbname>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>${liquibase.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <version>1.16.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.0</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <optimize>true</optimize>
                        <debug>true</debug>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <useReleaseProfile>false</useReleaseProfile>
                        <pushChanges>false</pushChanges>
                        <localCheckout>true</localCheckout>
                        <arguments>-Psonatype-oss-release</arguments>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.4.1</version>
                    <executions>
                        <execution>
                            <id>enforce-java</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireJavaVersion>
                                        <version>${java.version}</version>
                                    </requireJavaVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.7</version>
                <executions>
                    <execution>
                        <id>pmd</id>
                        <goals>
                            <goal>check</goal>
                            <goal>cpd-check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.4</version>
                <executions>
                    <execution>
                        <id>findbugs</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <version>1.15</version>
                <configuration>
                    <signature>
                        <groupId>org.codehaus.mojo.signature</groupId>
                        <artifactId>java16</artifactId>
                        <version>1.1</version>
                    </signature>
                </configuration>
                <executions>
                    <execution>
                        <id>animal-sniffer</id>
                        <phase>test</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Nexus Release Repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <profiles>
        <profile>
            <id>sonatype-oss-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-its</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>0.18.1</version>
                        <configuration>
                            <images>
                                <image>
                                    <name>mysql:5.7</name>
                                    <alias>liquibase-percona-mysql</alias>
                                    <run>
                                        <env>
                                            <MYSQL_ROOT_PASSWORD>${config_password}</MYSQL_ROOT_PASSWORD>
                                        </env>
                                        <namingStrategy>alias</namingStrategy>
                                        <ports>
                                            <port>config_port:3306</port>
                                        </ports>
                                        <wait>
                                            <tcp>
                                                <ports>
                                                    <port>3306</port>
                                                </ports>
                                            </tcp>
                                            <time>180000</time>
                                        </wait>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-docker</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-docker</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>2.0.0</version>
                        <configuration>
                            <!-- <debug>true</debug> -->
                            <projectsDirectory>src/it</projectsDirectory>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <preBuildHookScript>setup</preBuildHookScript>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <addTestClassPath>true</addTestClassPath>
                            <pomIncludes>
                                <pomInclude>*/pom.xml</pomInclude>
                            </pomIncludes>
                            <goals>
                                <goal>pre-integration-test</goal>
                            </goals>
                            <scriptVariables>
                                <config_host>${config_host}</config_host>
                                <config_port>${config_port}</config_port>
                                <config_user>${config_user}</config_user>
                                <config_password>${config_password}</config_password>
                                <config_dbname>${config_dbname}</config_dbname>
                            </scriptVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <issueManagement>
        <url>https://github.com/adangel/liquibase-percona/issues</url>
        <system>github</system>
    </issueManagement>
</project>