<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>

    <parent>
        <groupId>org.jooq</groupId>
        <artifactId>jooq_test</artifactId>
        <version>0.0.1</version>
    </parent>

    <artifactId>jooq-academy</artifactId>
    <name>jOOQ Academy</name>

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

    <dependencies>

        <!-- Database access -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j18-impl</artifactId>
            <version>2.17.2</version>
        </dependency>

    </dependencies>

    <build>

        <!-- The resources element will replace available properties in all matching
             resources. We use this to provide TiDB connection configuration to various
             configuration elements -->
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <fork>true</fork>
                    <maxmem>1024m</maxmem>
                    <meminitial>256m</meminitial>
                    <encoding>UTF-8</encoding>

                    <!-- IntelliJ needs these https://youtrack.jetbrains.com/issue/IDEA-195472 -->
                    <source>17</source>
                    <target>17</target>

                    <debug>true</debug>
                    <debuglevel>lines,vars,source</debuglevel>
                    <!-- [#2413] Make compiler warnings a bit more visible
                         But don't fail (yet) -->
                    <compilerArgs>
                        <arg>-Xlint:varargs</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <!-- We're using the properties plugin to load external properties into Maven.
                 See this excellent blog post for an explanation:
                 http://www.petrikainulainen.net/programming/tips-and-tricks/creating-profile-specific-configuration-files-with-maven/ -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0.0</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>src/main/resources/config.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <version>${jooq.version}</version>
                <configuration>
                    <jdbc>
                        <driver>com.mysql.cj.jdbc.Driver</driver>
                        <url>jdbc:mysql://127.0.0.1:4001/jooq-academy</url>
                        <user>root</user>
                        <password></password>
                    </jdbc>

                    <generator>
                        <database>
                            <includes>jooq-academy.*</includes>
                        </database>
                        <target>
                            <packageName>org.jooq.example.db.tidb</packageName>
                            <directory>src/test/java</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>