<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to ObjectStyle LLC under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ObjectStyle LLC licenses
  this file to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
  -->

<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.bootique.modules.parent</groupId>
        <artifactId>bootique-modules-parent</artifactId>
        <version>0.14</version>
    </parent>

    <groupId>io.bootique.jooq</groupId>
    <artifactId>bootique-jooq</artifactId>
    <version>1.0.RC1</version>
    <packaging>jar</packaging>

    <name>bootique-jooq: Jooq Integration with Bootique</name>
    <description>Provides Jooq integration with Bootique</description>

    <properties>
        <bootique.version>${project.version}</bootique.version>
        <jooq.version>3.10.6</jooq.version>
        <mysql.driver.version>8.0.8-dmr</mysql.driver.version>
    </properties>

    <scm>
        <developerConnection>scm:git:ssh://git@github.com/bootique/bootique-jooq</developerConnection>
        <url>https://github.com/bootique/bootique-jooq</url>
        <tag>1.0.RC1</tag>
    </scm>

    <distributionManagement>
        <repository>
            <id>bintray-bootique-releases</id>
            <name>bintray-bootique-releases</name>
            <url>https://api.bintray.com/maven/bootique/releases/bootique-jooq/;publish=1</url>
        </repository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jooq</groupId>
                <artifactId>jooq</artifactId>
                <version>${jooq.version}</version>
            </dependency>
            <dependency>
                <groupId>io.bootique</groupId>
                <artifactId>bootique</artifactId>
                <version>${bootique.version}</version>
            </dependency>
            <dependency>
                <groupId>io.bootique</groupId>
                <artifactId>bootique-test</artifactId>
                <version>${bootique.version}</version>
            </dependency>
            <dependency>
                <groupId>io.bootique.jdbc</groupId>
                <artifactId>bootique-jdbc</artifactId>
                <version>${bootique.version}</version>
            </dependency>
            <dependency>
                <groupId>io.bootique.jdbc</groupId>
                <artifactId>bootique-jdbc-hikaricp</artifactId>
                <version>${bootique.version}</version>
            </dependency>
            <dependency>
                <groupId>io.bootique.jdbc</groupId>
                <artifactId>bootique-jdbc-test</artifactId>
                <version>${bootique.version}</version>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>mysql</artifactId>
                <version>1.7.1</version>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql.driver.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Compile dependencies -->
        <dependency>
            <groupId>io.bootique</groupId>
            <artifactId>bootique</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.bootique.jdbc</groupId>
            <artifactId>bootique-jdbc</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- Unit test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.bootique</groupId>
            <artifactId>bootique-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.bootique.jdbc</groupId>
            <artifactId>bootique-jdbc-hikaricp</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.bootique.jdbc</groupId>
            <artifactId>bootique-jdbc-test</artifactId>
            <version>${bootique.version}</version>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mysql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jooq</groupId>
                    <artifactId>jooq-codegen-maven</artifactId>
                    <version>${jooq.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>mysql</groupId>
                            <artifactId>mysql-connector-java</artifactId>
                            <version>${mysql.driver.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <!--
                            Setup a DB for reverse engineering:

                            # prepend a dash to -name .. Can't place dash-dash in XML comment...
                            docker run -name jooqreveng -e MYSQL_ROOT_PASSWORD=root -p 4306:3306 -d mysql:5.7
                            # this comes from init_mysql.sql
                            docker exec -i jooqreveng mysql -uroot -proot \
                                <<< 'CREATE DATABASE `jooqdb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' docker exec -i jooqreveng mysql -uroot -proot \
                                <<< 'CREATE TABLE `jooqdb`.`test_table` (`id` integer primary key, `name` varchar(100));'

                            mvn org.jooq:jooq-codegen-maven:generate
                        -->
                        <jdbc>
                            <driver>com.mysql.jdbc.Driver</driver>
                            <url>jdbc:mysql://localhost:4306/jooqdb</url>
                            <user>root</user>
                            <password>root</password>
                        </jdbc>

                        <!-- Generator parameters -->
                        <generator>
                            <database>
                                <name>org.jooq.util.mysql.MySQLDatabase</name>
                                <includes>.*</includes>
                                <excludes />

                                <!-- Hmm.. "jooqdb" is a catalog, not schema in MySQL -->
                                <inputSchema>jooqdb</inputSchema>
                            </database>
                            <target>
                                <packageName>io.bootique.jooq.unit.generated</packageName>
                                <directory>src/test/java</directory>
                            </target>
                        </generator>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <!-- Optional profile used to sign artifacts -->
    <profiles>
        <profile>
            <id>gpg</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
