<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.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <groupId>com.github.bzacar</groupId>
  <artifactId>mongeez-shell</artifactId>
  <version>0.0.1</version>

  <name>Mongeez Shell</name>
  <description>Spring shell application to use mongeez library</description>
  <url>http://github.com/bzacar/mongeez-shell</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:bzacar/mongeez-shell.git</connection>
    <developerConnection>scm:git:git@github.com:bzacar/mongeez-shell.git</developerConnection>
    <url>git@github.com:bzacar/mongeez-shell.git</url>
  </scm>

  <developers>
    <developer>
      <id>bzacar</id>
      <name>Bilal Acar</name>
      <email>bilal.acar.a@gmail.com</email>
    </developer>
  </developers>

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

  <properties>
    <mongeez.version>0.9.10-bzacar</mongeez.version>
    <spring.boot.version>2.1.4.RELEASE</spring.boot.version>
    <spring-shell.version>2.0.0.RELEASE</spring-shell.version>
    <java.version>1.8</java.version>
    <kotlin.version>1.3.50</kotlin.version>
    <logback.version>1.2.3</logback.version>
    <slf4j.version>1.7.15</slf4j.version>
    <kotlin-logging.version>1.6.26</kotlin-logging.version>
    <dokka.version>0.10.0</dokka.version>
    <junit.version>5.3.1</junit.version>
    <assertj.version>3.11.1</assertj.version>
    <mockk.version>1.9.1</mockk.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-jdk8</artifactId>
      <version>${kotlin.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <version>${spring.boot.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.shell</groupId>
      <artifactId>spring-shell-starter</artifactId>
      <version>${spring-shell.version}</version>
    </dependency>
    <dependency>
      <groupId>com.github.bzacar</groupId>
      <artifactId>mongeez</artifactId>
      <version>${mongeez.version}</version>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>io.github.microutils</groupId>
      <artifactId>kotlin-logging</artifactId>
      <version>${kotlin-logging.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <version>${logback.version}</version>
    </dependency>
    <!-- /logging -->

    <!-- testing -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.mockk</groupId>
      <artifactId>mockk</artifactId>
      <version>${mockk.version}</version>
      <scope>test</scope>
    </dependency>
    <!-- /testing -->
  </dependencies>

  <build>
    <sourceDirectory>src/main/kotlin</sourceDirectory>
    <testSourceDirectory>src/test/kotlin</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-maven-plugin</artifactId>
        <version>${kotlin.version}</version>
        <configuration>
          <args>
            <arg>-Xjsr305=strict</arg>
          </args>
          <compilerPlugins>
            <plugin>spring</plugin>
          </compilerPlugins>
          <jvmTarget>1.8</jvmTarget>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-allopen</artifactId>
            <version>${kotlin.version}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <sourceDirs>
                <source>src/main/kotlin</source>
              </sourceDirs>
            </configuration>
          </execution>
          <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>test-compile</goal>
            </goals>
            <configuration>
              <sourceDirs>
                <source>src/test/kotlin</source>
              </sourceDirs>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring.boot.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>5.2.1</version>
        <configuration>
          <format>ALL</format>
          <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
          <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
          <nexusAnalyzerEnabled>false</nexusAnalyzerEnabled>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>site</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!--To release:
      mvn versions:set versions:commit -DnewVersion="<version without snapshot>"
      export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
      mvn clean deploy -DperformRelease
      export JAVA_HOME=
      mvn versions:set versions:commit -DnewVersion="<next version with snapshot>"
      -->
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.jetbrains.dokka</groupId>
            <artifactId>dokka-maven-plugin</artifactId>
            <version>${dokka.version}</version>
            <executions>
              <execution>
                <phase>prepare-package</phase>
                <goals>
                  <goal>dokka</goal>
                  <goal>javadoc</goal>
                  <goal>javadocJar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <includes>
                <file>packages.md</file>
              </includes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
