<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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>

    <!-- Basic information -->

    <groupId>com.wishurgift</groupId>
    <artifactId>wishurgift</artifactId>
    <version>1.2.5-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>Wishurgift</name>
    <description>Wishlist application</description>

    <!-- Project properties -->

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <tomee.version>8.0.0</tomee.version>
        <openjpa.version>3.0.0</openjpa.version>
        <junit.version>4.13</junit.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <war.package.path>target/${project.artifactId}-${project.version}.war</war.package.path>
        <war.webapps.path>web/apps/ROOT.war</war.webapps.path>
        <db.url>//localhost:5432/wishurgift</db.url>
        <db.user>admin</db.user>
        <db.password>password</db.password>
    </properties>

    <!-- Dependencies -->

    <dependencies>
        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.2.4</version>
            <scope>test</scope>
        </dependency>
        <!-- Web -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomee</groupId>
            <artifactId>tomee-embedded</artifactId>
            <version>${tomee.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomee</groupId>
            <artifactId>openejb-core</artifactId>
            <version>${tomee.version}</version>
            <scope>test</scope>
            <!-- Ne pas utiliser le slf4j de tomee -->
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jdk14</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.tomee</groupId>
            <artifactId>tomee-jaxrs</artifactId>
            <version>${tomee.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomee</groupId>
            <artifactId>ziplock</artifactId>
            <version>${tomee.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- Authentification -->
        <dependency>
            <!-- Hash pour le mot de passe -->
            <groupId>at.favre.lib</groupId>
            <artifactId>bcrypt</artifactId>
            <version>0.9.0</version>
        </dependency>
        <dependency>
            <!-- Token pour la connexion -->
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.9.0</version>
        </dependency>
        <!-- BDD -->
        <dependency>
            <!-- SGBD -->
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.9</version>
        </dependency>
        <dependency>
            <!-- JPA implementation -->
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <!-- Gestion maj données bdd -->
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>3.8.5</version>
        </dependency>
        <dependency>
            <!-- Gestion maj données bdd -->
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>3.8.5</version>
        </dependency>
        <!-- Utilitaire -->
        <dependency>
            <!-- Simplification code -->
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.10</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <!-- Apache Common validator (pour valider l'email par exemple) -->
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <!-- Gestion des logs -->
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        <dependency>
            <!-- Utilitaire pour les nombres -->
            <groupId>org.decimal4j</groupId>
            <artifactId>decimal4j</artifactId>
            <version>1.0.3</version>
        </dependency>
    </dependencies>

    <!-- Build plugin -->
    <build>
        <plugins>
            <plugin>
                <!-- Compilateur -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <!-- Copie le war dans tomee -->
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <target>
                                <copy file="${war.package.path}"
                                      tofile="${war.webapps.path}"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- Execute Liquibase -->
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>3.8.5</version>
                <configuration>
                    <changeLogFile>src/main/resources/liquibase/changelog-master.xml</changeLogFile>
                    <driver>org.postgresql.Driver</driver>
                    <url>jdbc:postgresql:${db.url}</url>
                    <username>${db.user}</username>
                    <password>${db.password}</password>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>update</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Skip test -->
            <!--plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin-->
        </plugins>
    </build>

</project>