<?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>
    <parent>
        <groupId>de.fraunhofer.iosb.ilt.FROST-Server</groupId>
        <artifactId>FROST-ServerParent</artifactId>
        <version>1.14.4</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>FROST-Server.HTTP</artifactId>
    <packaging>war</packaging>

    <name>FROST-Server.HTTP</name>
    <description>The web-application making the FROST-Server available over HTTP.</description>
    <url>https://github.com/FraunhoferIOSB/FROST-Server</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <docker-image-name>fraunhoferiosb/frost-server-http</docker-image-name>
    </properties>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>FROST-Server.Core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>FROST-Server.HTTP.Common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>FROST-Server.Auth.Basic</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>FROST-Server.Auth.Keycloak</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>FROST-Server.SQLjooq</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven-war-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${maven-dependency-plugin.version}</version>
                <executions>
                    <execution>
                        <id>endorsed</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${endorsed.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>javax</groupId>
                                    <artifactId>javaee-endorsed-api</artifactId>
                                    <version>7.0</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>docker_deps</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${docker.dependencies.dir}</outputDirectory>
                            <silent>true</silent>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.postgresql</groupId>
                                    <artifactId>postgresql</artifactId>
                                    <version>${postgres.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>net.postgis</groupId>
                                    <artifactId>postgis-jdbc</artifactId>
                                    <version>${postgis.version}</version>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>${dockerfile-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>build-and-tag-latest</id>
                        <phase>none</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>tag-version</id>
                        <phase>none</phase>
                        <goals>
                            <goal>tag</goal>
                        </goals>
                        <configuration>
                            <tag>${env.DOCKER_TAG}</tag>
                        </configuration>
                    </execution>
                    <execution>
                        <id>push-latest</id>
                        <phase>none</phase>
                        <goals>
                            <goal>push</goal>
                        </goals>
                        <configuration>
                            <tag>latest</tag>
                        </configuration>
                    </execution>
                    <execution>
                        <id>push-version</id>
                        <phase>none</phase>
                        <goals>
                            <goal>push</goal>
                        </goals>
                        <configuration>
                            <tag>${env.DOCKER_TAG}</tag>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <repository>${docker-image-name}</repository>
                    <buildArgs>
                        <WAR_FILE>${project.build.finalName}.war</WAR_FILE>
                    </buildArgs>
                </configuration>
                <dependencies>
                    <!-- Java 9 support -->
                    <dependency>
                        <groupId>javax.activation</groupId>
                        <artifactId>activation</artifactId>
                        <version>${javax-activation.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>
