<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright The WildFly Authors
  ~ SPDX-License-Identifier: Apache-2.0
  -->

<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.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>40</version>
    </parent>

    <groupId>org.wildfly.launcher</groupId>
    <artifactId>wildfly-launcher</artifactId>
    <version>1.0.0.Beta1</version>

    <name>WildFly: Launcher API</name>
    <description>Tooling for launching WildFly technology stack processes.</description>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:${wildfly.launcher.scm.connection}</connection>
        <developerConnection>scm:git:${wildfly.launcher.scm.connection}</developerConnection>
        <url>${wildfly.launcher.scm.url}</url>
    </scm>

    <properties>
        <wildfly.launcher.scm.connection>git@github.com:wildfly/wildfly-launcher.git</wildfly.launcher.scm.connection>
        <wildfly.launcher.scm.url>https://github.com/wildfly/wildfly-launcher</wildfly.launcher.scm.url>

        <wildfly.launcher.home>${basedir}/target/fake-wildfly</wildfly.launcher.home>
        <wildfly.launcher.bootable.jar>${basedir}/target/fake-wildfly.jar</wildfly.launcher.bootable.jar>

        <!-- Base on SE 11. -->
        <maven.compiler.target>11</maven.compiler.target>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.release>11</maven.compiler.release>

        <!-- Dependency versions -->

        <!-- Non-default maven plugin versions and configuration -->
        <version.org.wildfly.checkstyle-config>1.0.8.Final</version.org.wildfly.checkstyle-config>

        <!-- Production/build time dependencies-->
        <version.org.jboss.logging.jboss-logging>3.6.1.Final</version.org.jboss.logging.jboss-logging>
        <version.org.jboss.logging.jboss-logging-tools>3.0.2.Final</version.org.jboss.logging.jboss-logging-tools>
        <!-- Test dependencies -->
        <version.org.jboss.modules.jboss-modules>2.1.5.Final</version.org.jboss.modules.jboss-modules>
        <version.junit.junit>4.13.2</version.junit.junit>
    </properties>

    <dependencies>
        <!-- This dependency is only needed at compile time and requires no runtime dependencies -->
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <version>${version.org.jboss.logging.jboss-logging}</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-annotations</artifactId>
            <version>${version.org.jboss.logging.jboss-logging-tools}</version>
            <!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
                  projects that depend on this project.-->
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-processor</artifactId>
            <version>${version.org.jboss.logging.jboss-logging-tools}</version>
            <!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
                  projects that depend on this project.-->
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit.junit}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.modules</groupId>
            <artifactId>jboss-modules</artifactId>
            <version>${version.org.jboss.modules.jboss-modules}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.jar.plugin}</version>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Scm-Url>${wildfly.launcher.scm.url}</Scm-Url>
                            </manifestEntries>
                        </archive>
                        <!-- Do not package the generated logging properties as the generated binaries will be packaged -->
                        <!-- These files are not required at runtime -->
                        <excludes>
                            <exclude>**/*.i18n.properties</exclude>
                            <exclude>**/*.i18n_*.properties</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.javadoc.plugin}</version>
                    <configuration>
                        <doclint>none</doclint>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.surefire</groupId>
                            <artifactId>surefire-junit47</artifactId>
                            <version>${version.surefire.plugin}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
                        <enableAssertions>true</enableAssertions>
                        <systemPropertyVariables>
                            <test.level>${test.level}</test.level>
                        </systemPropertyVariables>
                        <argLine>${surefire.system.args}</argLine>
                    </configuration>

                </plugin>
                <!-- Checkstyle -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.checkstyle.plugin}</version>
                    <executions>
                        <execution>
                            <id>check-style</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.wildfly.checkstyle</groupId>
                            <artifactId>wildfly-checkstyle-config</artifactId>
                            <version>${version.org.wildfly.checkstyle-config}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <excludes>**/*$logger.java,**/*$bundle.java</excludes>
                        <useFile></useFile>
                    </configuration>
                </plugin>

                <!-- Require Java 11 for deploying -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${version.enforcer.plugin}</version>
                    <executions>
                        <execution>
                            <id>require-java11</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <phase>deploy</phase>
                            <configuration>
                                <rules>
                                    <requireJavaVersion>
                                        <version>[11,12)</version>
                                    </requireJavaVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <!-- Create a fake WildFly directory -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-deps</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.modules</groupId>
                                    <artifactId>jboss-modules</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${wildfly.launcher.home}</outputDirectory>
                                    <destFileName>jboss-modules.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <wildfly.launcher.home>${wildfly.launcher.home}</wildfly.launcher.home>
                        <wildfly.launcher.bootable.jar>${wildfly.launcher.bootable.jar}</wildfly.launcher.bootable.jar>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>

    </build>

</project>
