<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.

    Licensed 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: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>
    <parent>
        <groupId>io.helidon</groupId>
        <artifactId>helidon-dependencies</artifactId>
        <version>2.0.0-RC2</version>
        <relativePath>../dependencies/pom.xml</relativePath>
    </parent>
    <groupId>io.helidon.applications</groupId>
    <artifactId>helidon-applications-project</artifactId>
    <packaging>pom</packaging>
    <name>Helidon Applications Project</name>
    <description>Maven boilerplate for Helidon applications</description>

    <modules>
        <module>se</module>
        <module>mp</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
        <maven.compiler.release>${maven.compiler.source}</maven.compiler.release>
        <version.plugin.compiler>3.8.1</version.plugin.compiler>
        <version.plugin.dependency>3.1.2</version.plugin.dependency>
        <version.plugin.exec>1.6.0</version.plugin.exec>
        <version.plugin.failsafe>2.19.1</version.plugin.failsafe>
        <version.plugin.helidon>2.0.0-RC3</version.plugin.helidon>
        <version.plugin.jar>3.0.2</version.plugin.jar>
        <version.plugin.os>1.5.0.Final</version.plugin.os>
        <version.plugin.protobuf>0.5.1</version.plugin.protobuf>
        <version.plugin.resources>2.7</version.plugin.resources>
        <version.plugin.surefire.provider.junit>1.0.3</version.plugin.surefire.provider.junit>
        <version.plugin.surefire>2.19.1</version.plugin.surefire>
    </properties>

    <build>
        <finalName>${project.artifactId}</finalName>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${version.plugin.os}</version>
            </extension>
        </extensions>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.plugin.compiler}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.plugin.surefire}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.junit.platform</groupId>
                            <artifactId>junit-platform-surefire-provider</artifactId>
                            <version>${version.plugin.surefire.provider.junit}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.junit.jupiter</groupId>
                            <artifactId>junit-jupiter-engine</artifactId>
                            <version>${version.lib.junit}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <systemPropertyVariables>
                            <java.util.logging.config.file>${project.build.outputDirectory}/logging.properties</java.util.logging.config.file>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.plugin.failsafe}</version>
                    <configuration>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.junit.platform</groupId>
                            <artifactId>junit-platform-surefire-provider</artifactId>
                            <version>${version.plugin.surefire.provider.junit}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.junit.jupiter</groupId>
                            <artifactId>junit-jupiter-engine</artifactId>
                            <version>${version.lib.junit}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${version.plugin.dependency}</version>
                    <executions>
                        <execution>
                            <id>copy-libs</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/libs</outputDirectory>
                                <overWriteReleases>false</overWriteReleases>
                                <overWriteSnapshots>false</overWriteSnapshots>
                                <overWriteIfNewer>true</overWriteIfNewer>
                                <overWriteIfNewer>true</overWriteIfNewer>
                                <includeScope>runtime</includeScope>
                                <excludeScope>test</excludeScope>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${version.plugin.resources}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.plugin.jar}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <classpathPrefix>libs</classpathPrefix>
                                <!--suppress MavenModelInspection -->
                                <mainClass>${mainClass}</mainClass>
                                <useUniqueVersions>false</useUniqueVersions>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${version.plugin.exec}</version>
                    <configuration>
                        <!--suppress MavenModelInspection -->
                        <mainClass>${mainClass}</mainClass>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>io.helidon.build-tools</groupId>
                    <artifactId>helidon-maven-plugin</artifactId>
                    <version>${version.plugin.helidon}</version>
                </plugin>
                <plugin>
                    <groupId>org.xolstice.maven.plugins</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>${version.plugin.protobuf}</version>
                    <configuration>
                        <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
                        <pluginId>grpc-java</pluginId>
                        <pluginArtifact>io.grpc:protoc-gen-grpc-java:${version.lib.grpc}:exe:${os.detected.classifier}</pluginArtifact>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>helidon-cli</id>
            <activation>
                <property>
                    <name>helidon.cli</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.helidon.build-tools</groupId>
                        <artifactId>helidon-maven-plugin</artifactId>
                        <version>${version.plugin.helidon}</version>
                        <extensions>true</extensions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
