<?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>
  <groupId>com.dream11</groupId>
  <artifactId>vertx-rest</artifactId>
  <version>1.0.0</version>
  <packaging>jar</packaging>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Vertx library for writing rest application based on JAX-RS annotations</description>
  <url>https://github.com/dream11/vertx-rest</url>

  <scm>
    <developerConnection>scm:git:https://github.com/dream11/vertx-rest.git</developerConnection>
    <connection>scm:git:https://github.com/dream11/vertx-rest.git</connection>
    <url>https://github.com/dream11/vertx-rest</url>
    <tag>HEAD</tag>
  </scm>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>https://github.com/dream11/vertx-rest/raw/master/LICENSE</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Akshay Patidar</name>
      <email>akshay.patidar@dream11.com</email>
      <organization>Dream11</organization>
      <organizationUrl>https://www.dream11.com/</organizationUrl>
    </developer>
  </developers>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <vertx.version>4.3.4</vertx.version>
    <lombok.version>1.18.24</lombok.version>
    <commons-validator.version>1.7</commons-validator.version>
    <resteasy.version>6.2.2.Final</resteasy.version>
    <hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
    <jakarta.el.version>4.0.2</jakarta.el.version>
    <swagger-jaxrs2-jakarta.version>2.2.6</swagger-jaxrs2-jakarta.version>
    <reflections.version>0.10.2</reflections.version>
    <guice.version>5.1.0</guice.version>
    <slf4j.version>2.0.5</slf4j.version>
    <logback.version>1.4.5</logback.version>
    <commons-io.version>2.11.0</commons-io.version>
    <checkstyle.version>8.32</checkstyle.version>
    <junit-jupiter.version>5.7.0</junit-jupiter.version>
    <junit.version>4.13.2</junit.version>
    <hamcrest.version>2.2</hamcrest.version>

    <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
    <maven.compile.version>11</maven.compile.version>
    <maven.compile.source>11</maven.compile.source>
    <maven.compile.target>11</maven.compile.target>
    <maven.clean.plugin.version>3.1.0</maven.clean.plugin.version>
    <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
    <maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
    <maven.failsafe.plugin.version>3.0.0-M5</maven.failsafe.plugin.version>
    <maven.jacoco.plugin.version>0.8.8</maven.jacoco.plugin.version>
    <maven.source.plugin.version>3.2.1</maven.source.plugin.version>
    <maven.gpg.plugin.version>3.0.1</maven.gpg.plugin.version>
    <maven.release.plugin.version>3.0.0-M7</maven.release.plugin.version>
    <maven.checkstyle.plugin.version>3.2.0</maven.checkstyle.plugin.version>

    <maven.swagger.plugin.jakarta.version>2.2.6</maven.swagger.plugin.jakarta.version>
    <maven.dependency.plugin.version>3.1.2</maven.dependency.plugin.version>
    <swagger.outputFileName>swagger</swagger.outputFileName>
    <swagger.configurationFilePath>${project.basedir}/src/test/resources/config/swagger/swagger-info.json</swagger.configurationFilePath>
    <swagger.outputPath>target/classes/webroot/swagger</swagger.outputPath>
    <swagger.resourcePackage>com.dream11.rest.app</swagger.resourcePackage>
    <resource.directory>src/test/resources</resource.directory>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-rx-java3</artifactId>
    </dependency>

    <!--  Logging  -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <version>${logback.version}</version>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
    </dependency>


    <dependency>
      <groupId>org.reflections</groupId>
      <artifactId>reflections</artifactId>
      <version>${reflections.version}</version>
    </dependency>

    <dependency>
      <groupId>commons-validator</groupId>
      <artifactId>commons-validator</artifactId>
      <version>${commons-validator.version}</version>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>${commons-io.version}</version>
    </dependency>

    <!--    RestEasy  -->
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-vertx</artifactId>
      <version>${resteasy.version}</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-validator-provider</artifactId>
      <version>${resteasy.version}</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson2-provider</artifactId>
      <version>${resteasy.version}</version>
    </dependency>

    <dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>${hibernate-validator.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>jakarta.el</artifactId>
      <version>${jakarta.el.version}</version>
    </dependency>

    <!--    Swagger   -->
    <dependency>
      <groupId>io.swagger.core.v3</groupId>
      <artifactId>swagger-jaxrs2-jakarta</artifactId>
      <version>${swagger-jaxrs2-jakarta.version}</version>
    </dependency>

    <!--   Tests   -->
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-junit5</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit-jupiter.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit-jupiter.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <version>${hamcrest.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.google.inject</groupId>
      <artifactId>guice</artifactId>
      <version>${guice.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-stack-depchain</artifactId>
        <version>${vertx.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven.javadoc.plugin.version}</version>
        <configuration>
          <noqualifier>all</noqualifier>
          <detectJavaApiLink>false</detectJavaApiLink>
          <doclint>none</doclint>
        </configuration>
        <executions>
          <execution>
            <configuration>
              <reportOutputDirectory>target</reportOutputDirectory>
            </configuration>
            <id>aggregate</id>
            <goals>
              <goal>aggregate</goal>
            </goals>
            <phase>verify</phase>
          </execution>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <configuration>
          <compilerVersion>${maven.compile.version}</compilerVersion>
          <source>${maven.compile.source}</source>
          <target>${maven.compile.target}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <useIncrementalCompilation>false</useIncrementalCompilation>

          <annotationProcessors combine.children="append">
            <annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
            <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
          </annotationProcessors>
          <generatedSourcesDirectory>${project.basedir}/src/main/generated</generatedSourcesDirectory>
          <compilerArgs>
            <arg>-Acodegen.output=${project.basedir}/src/main</arg>
          </compilerArgs>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>${maven.clean.plugin.version}</version>
        <configuration>
          <filesets>
            <fileset>
              <directory>${project.basedir}/src/main/generated</directory>
            </fileset>
          </filesets>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.plugin.version}</version>
        <configuration>
          <!-- Ensures root cause ends up in the console -->
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${maven.jacoco.plugin.version}</version>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- For Integration Tests-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven.failsafe.plugin.version}</version>
        <executions>
          <execution>
            <id>integration-tests</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <!-- workaround to https://issues.apache.org/jira/browse/SUREFIRE-1831 -->
              <useModulePath>false</useModulePath>
              <!-- Ensures root cause ends up in the console -->
              <trimStackTrace>false</trimStackTrace>
            </configuration>
          </execution>
        </executions>
      </plugin>

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

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>${maven.release.plugin.version}</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <releaseProfiles>release</releaseProfiles>
          <tagNameFormat>v@{project.version}</tagNameFormat>
          <signTag>true</signTag>
          <scmDevelopmentCommitComment>chore(pom): bump version for next iteration</scmDevelopmentCommitComment>
          <scmReleaseCommitComment>release(pom): prepare release @{releaseLabel}</scmReleaseCommitComment>
          <goals>deploy</goals>
        </configuration>
      </plugin>

      <plugin>
        <groupId>io.swagger.core.v3</groupId>
        <artifactId>swagger-maven-plugin-jakarta</artifactId>
        <version>${maven.swagger.plugin.jakarta.version}</version>
        <configuration>
          <outputFileName>${swagger.outputFileName}</outputFileName>
          <configurationFilePath>${swagger.configurationFilePath}</configurationFilePath>
          <outputPath>${swagger.outputPath}</outputPath>
          <outputFormat>JSONANDYAML</outputFormat>
          <resourcePackages>
            <package>${swagger.resourcePackage}</package>
          </resourcePackages>
          <prettyPrint>true</prettyPrint>
        </configuration>
        <executions>
          <execution>
            <id>generate-swagger-docs-test</id>
            <phase>test-compile</phase>
            <goals>
              <goal>resolve</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven.checkstyle.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <consoleOutput>true</consoleOutput>
          <violationSeverity>warning</violationSeverity>
          <configLocation>checkstyle.xml</configLocation>
        </configuration>
      </plugin>

    </plugins>
  </build>

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