<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <artifactId>jooby</artifactId>
  <groupId>com.techempower</groupId>
  <version>2.0</version>

  <name>jooby</name>

  <properties>
    <jooby.version>2.9.3</jooby.version>
    <netty.version>4.1.49.Final</netty.version>
    <dsl-json.version>1.9.5</dsl-json.version>
    <postgresql.version>42.2.13</postgresql.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <!-- Startup class -->
    <application.class>com.techempower.App</application.class>
  </properties>

  <dependencies>
    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
    </dependency>

    <!-- jdbc -->
    <dependency>
      <groupId>io.jooby</groupId>
      <artifactId>jooby-hikari</artifactId>
    </dependency>

    <!-- rocker -->
    <dependency>
      <groupId>io.jooby</groupId>
      <artifactId>jooby-rocker</artifactId>
    </dependency>

    <!-- mySQL -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
    </dependency>

    <!-- postgresql -->
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>${postgresql.version}</version>
    </dependency>

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-pg-client</artifactId>
      <version>3.9.2</version>
    </dependency>

    <!-- json -->
    <dependency>
      <groupId>com.dslplatform</groupId>
      <artifactId>dsl-json-java8</artifactId>
      <version>${dsl-json.version}</version>
    </dependency>
  </dependencies>

  <build>
    <finalName>jooby</finalName>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.outputDirectory}${file.separator}generated-sources${file.separator}annotations</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.fizzed</groupId>
        <artifactId>rocker-maven-plugin</artifactId>
        <version>1.3.0</version>
        <executions>
          <execution>
            <id>generate-rocker-templates</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <templateDirectory>public</templateDirectory>
              <touchFile>/dev/null</touchFile>
              <optimize>true</optimize>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <annotationProcessorPaths>
            <path>
              <groupId>io.jooby</groupId>
              <artifactId>jooby-apt</artifactId>
              <version>${jooby.version}</version>
            </path>
            <path>
              <groupId>com.dslplatform</groupId>
              <artifactId>dsl-json-java8</artifactId>
              <version>${dsl-json.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <!-- Build fat jar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <id>uber-jar</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <transformers>
                <transformer
                    implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <transformer
                    implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>${application.class}</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>undertow</id>
      <dependencies>
        <dependency>
          <groupId>io.jooby</groupId>
          <artifactId>jooby-utow</artifactId>
          <version>${jooby.version}</version>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>jetty</id>
      <dependencies>
        <dependency>
          <groupId>io.jooby</groupId>
          <artifactId>jooby-jetty</artifactId>
          <version>${jooby.version}</version>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>netty</id>
      <dependencies>
        <dependency>
          <groupId>io.netty</groupId>
          <artifactId>netty-common</artifactId>
          <version>${netty.version}</version>
        </dependency>

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

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

        <dependency>
          <groupId>io.netty</groupId>
          <artifactId>netty-codec-http</artifactId>
          <version>${netty.version}</version>
        </dependency>

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

        <dependency>
          <groupId>io.netty</groupId>
          <artifactId>netty-transport-native-epoll</artifactId>
          <version>${netty.version}</version>
        </dependency>

        <dependency>
          <groupId>io.netty</groupId>
          <artifactId>netty-transport-native-kqueue</artifactId>
          <version>${netty.version}</version>
          <classifier>osx-x86_64</classifier>
        </dependency>
        <dependency>
          <groupId>io.netty</groupId>
          <artifactId>netty-transport-native-epoll</artifactId>
          <version>${netty.version}</version>
          <classifier>linux-x86_64</classifier>
        </dependency>
        <dependency>
          <groupId>io.jooby</groupId>
          <artifactId>jooby-netty</artifactId>
          <version>${jooby.version}</version>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.jooby</groupId>
        <artifactId>jooby-bom</artifactId>
        <version>${jooby.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>
