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

<!--
  ~ This file is part of the Yildiz-Engine project, licenced under the MIT License  (MIT)
  ~
  ~  Copyright (c) 2019-2021 Grégory Van den Borre
  ~
  ~  More infos available: https://engine.yildiz-games.be
  ~
  ~  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  ~  documentation files (the "Software"), to deal in the Software without restriction, including without
  ~  limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  ~  of the Software, and to permit persons to whom the Software is furnished to do so,
  ~  subject to the following conditions:
  ~
  ~  The above copyright notice and this permission notice shall be included in all copies or substantial
  ~  portions of the Software.
  ~
  ~  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  ~  WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
  ~  OR COPYRIGHT  HOLDERS BE LIABLE FOR ANY CLAIM,
  ~  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  SOFTWARE.
  ~
  -->

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

  <name>Yildiz-Engine Parent</name>
  <description>Project to hold the parent pom for all children projects.</description>
  <inceptionYear>2009</inceptionYear>
  <url>https://engine.yildiz-games.be</url>

  <groupId>be.yildiz-games</groupId>
  <artifactId>parent</artifactId>
  <version>5.0.2</version>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>https://github.com/yildiz-online/parent/blob/develop/LICENSE</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Grégory Van den Borre</name>
      <email>vandenborre.gregory@hotmail.fr</email>
      <url>https://github.com/yildiz-online</url>
    </developer>
  </developers>

  <issueManagement>
    <system>JIRA</system>
    <url>https://yildiz.atlassian.net</url>
  </issueManagement>

  <scm>
    <connection>scm:git:https://github.com/yildiz-online/parent</connection>
    <developerConnection>scm:git:https://github.com/yildiz-online/parent</developerConnection>
    <url>https://github.com/yildiz-online/parent</url>
  </scm>

  <packaging>pom</packaging>

  <properties>
    <java.version>17</java.version>

    <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
    <kotlin.version>1.6.0</kotlin.version>

    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <maven.compiler.release>${java.version}</maven.compiler.release>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.resources.sourceEncoding>UTF-8</project.resources.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <maven.plugin.clean.version>3.1.0</maven.plugin.clean.version>
    <maven.plugin.compiler.version>3.8.1</maven.plugin.compiler.version>
    <maven.plugin.deploy.version>2.8.2</maven.plugin.deploy.version>
    <maven.plugin.failsafe.version>3.0.0-M5</maven.plugin.failsafe.version>
    <maven.plugin.install.version>2.5.2</maven.plugin.install.version>
    <maven.plugin.resources.version>3.2.0</maven.plugin.resources.version>
    <maven.plugin.site.version>3.9.1</maven.plugin.site.version>
    <maven.plugin.surefire.version>3.0.0-M5</maven.plugin.surefire.version>
    <maven.plugin.verifier.version>1.1</maven.plugin.verifier.version>

    <maven.plugin.jar.version>3.2.0</maven.plugin.jar.version>
    <maven.plugin.source.version>3.2.1</maven.plugin.source.version>

    <maven.plugin.javadoc.version>3.3.1</maven.plugin.javadoc.version>

    <maven.plugin.antrun.version>3.0.0</maven.plugin.antrun.version>
    <maven.plugin.assembly.version>3.3.0</maven.plugin.assembly.version>
    <maven.plugin.dependency.version>3.2.0</maven.plugin.dependency.version>
    <maven.plugin.enforcer.version>3.0.0</maven.plugin.enforcer.version>
    <maven.plugin.gpg.version>3.0.1</maven.plugin.gpg.version>
    <maven.plugin.release.version>2.5.3</maven.plugin.release.version>
    <maven.plugin.scm.version>1.12.0</maven.plugin.scm.version>

    <maven.plugin.sonar.version>3.9.1.2184</maven.plugin.sonar.version>
    <maven.plugin.jacoco.version>0.8.7</maven.plugin.jacoco.version>
    <maven.plugin.exec.version>3.0.0</maven.plugin.exec.version>
    <maven.plugin.build-helper.version>3.2.0</maven.plugin.build-helper.version>
    <maven.plugin.pitest.version>1.7.3</maven.plugin.pitest.version>
    <maven.plugin.nexus.version>1.6.8</maven.plugin.nexus.version>
    <maven.plugin.nexus.serverId>ossrh</maven.plugin.nexus.serverId>
    <maven.plugin.nexus.nexusUrl>https://oss.sonatype.org/</maven.plugin.nexus.nexusUrl>
    <maven.plugin.nexus.autoReleaseAfterClose>true</maven.plugin.nexus.autoReleaseAfterClose>
    <maven.plugin.version.version>2.8.1</maven.plugin.version.version>
    <maven.plugin.owasp-dependency-check.version>6.5.0</maven.plugin.owasp-dependency-check.version>
    <sonar.binaries>${project.basedir}/target/classes</sonar.binaries>

    <dependency.junit.version>5.8.1</dependency.junit.version>
    <dependency.cucumber.version>7.0.0</dependency.cucumber.version>
    <dependency.awaitility.version>1.7.0</dependency.awaitility.version>

  </properties>

  <prerequisites>
    <maven>3.8.2</maven>
  </prerequisites>

  <build>
    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${maven.plugin.build-helper.version}</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>${maven.plugin.version.version}</version>
          <configuration>
            <outputFile>${basedir}/target/outdated-dependencies.txt</outputFile>
            <rulesUri>file://${basedir}/maven-version-rules.xml</rulesUri>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven.plugin.clean.version}</version>
        </plugin>

        <plugin>
          <groupId>org.jetbrains.kotlin</groupId>
          <artifactId>kotlin-maven-plugin</artifactId>
          <version>${kotlin.version}</version>
          <executions>
            <execution>
              <id>compile</id>
              <goals> <goal>compile</goal> </goals>
              <configuration>
                <sourceDirs>
                  <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                  <sourceDir>${project.basedir}/src/main/java</sourceDir>
                </sourceDirs>
              </configuration>
            </execution>
            <execution>
              <id>test-compile</id>
              <goals> <goal>test-compile</goal> </goals>
              <configuration>
                <sourceDirs>
                  <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                  <sourceDir>${project.basedir}/src/test/java</sourceDir>
                </sourceDirs>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven.plugin.compiler.version}</version>
          <configuration>
            <jdkToolchain><version>${java.version}</version></jdkToolchain>
            <release>${maven.compiler.release}</release>
            <source>${maven.compiler.source}</source>
            <target>${maven.compiler.target}</target>
          </configuration>
          <executions>
            <execution>
              <id>default-compile</id>
              <phase>none</phase>
            </execution>
            <execution>
              <id>default-testCompile</id>
              <phase>none</phase>
            </execution>
            <execution>
              <id>java-compile</id>
              <phase>compile</phase>
              <goals> <goal>compile</goal> </goals>
            </execution>
            <execution>
              <id>java-test-compile</id>
              <phase>test-compile</phase>
              <goals> <goal>testCompile</goal> </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven.plugin.deploy.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven.plugin.install.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven.plugin.resources.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven.plugin.surefire.version}</version>
          <configuration>
            <useSystemClassLoader>false</useSystemClassLoader>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-verifier-plugin</artifactId>
          <version>${maven.plugin.verifier.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven.plugin.jar.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven.plugin.site.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>${maven.plugin.antrun.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${maven.plugin.assembly.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven.plugin.dependency.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven.plugin.release.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <version>${maven.plugin.scm.version}</version>
        </plugin>

        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>${maven.plugin.sonar.version}</version>
        </plugin>

        <plugin>
          <artifactId>exec-maven-plugin</artifactId>
          <groupId>org.codehaus.mojo</groupId>
          <version>${maven.plugin.exec.version}</version>
        </plugin>

        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>${maven.plugin.nexus.version}</version>
          <extensions>true</extensions>
          <configuration>
            <serverId>${maven.plugin.nexus.serverId}</serverId>
            <nexusUrl>${maven.plugin.nexus.nexusUrl}</nexusUrl>
            <autoReleaseAfterClose>${maven.plugin.nexus.autoReleaseAfterClose}</autoReleaseAfterClose>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven.plugin.source.version}</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>verify</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven.plugin.javadoc.version}</version>
          <configuration>
            <excludePackageNames>*.generated.*</excludePackageNames>
            <quiet>true</quiet>
            <encoding>UTF-8</encoding>
          </configuration>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <phase>verify</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>org.ow2.asm</groupId>
              <artifactId>asm</artifactId>
              <version>9.2</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven.plugin.gpg.version}</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>deploy</phase>
              <goals>
                <goal>sign</goal>
              </goals>
              <configuration>
                <gpgArguments>
                  <arg>--pinentry-mode</arg>
                  <arg>loopback</arg>
                </gpgArguments>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.pitest</groupId>
          <artifactId>pitest-maven</artifactId>
          <version>${maven.plugin.pitest.version}</version>
          <configuration>
            <targetClasses>
              <param>be.yildizgames.*</param>
            </targetClasses>
            <targetTests>
              <param>be.yildizgames.*</param>
            </targetTests>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven.plugin.enforcer.version}</version>
          <executions>
            <execution>
              <id>enforce-maven</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.5.2</version>
                  </requireMavenVersion>
                  <requireReleaseDeps>
                    <onlyWhenRelease>true</onlyWhenRelease>
                    <message>Snapshot dependencies are not allowed in releases.</message>
                  </requireReleaseDeps>
                  <dependencyConvergence/>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.owasp</groupId>
          <artifactId>dependency-check-maven</artifactId>
          <version>${maven.plugin.owasp-dependency-check.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
    <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${maven.plugin.jacoco.version}</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>${kotlin.version}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${dependency.junit.version}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <version>${dependency.junit.version}</version>
      </dependency>
      <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${dependency.cucumber.version}</version>
      </dependency>
      <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>${dependency.cucumber.version}</version>
      </dependency>
      <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${dependency.cucumber.version}</version>
      </dependency>
      <dependency>
        <groupId>com.jayway.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>${dependency.awaitility.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <profiles>
    <profile>
      <id>deploy-to-central</id>
      <activation>
        <property>
          <name>!maven.plugin.nexus.skip</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
          <id>ossrh</id>
          <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
      </distributionManagement>
    </profile>
    <profile>
      <id>deploy-to-private</id>
      <activation>
        <property>
          <name>maven.plugin.nexus.skip</name>
        </property>
      </activation>
      <distributionManagement>
        <repository>
          <id>yildiz-engine-nexus-release</id>
          <name>Releases</name>
          <url>https://nexus.yildiz-games.be/repository/Yildiz-Engine-Release/</url>
        </repository>
      </distributionManagement>
    </profile>
    <profile>
      <id>owasp</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
