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

  <groupId>com.techempower</groupId>
  <artifactId>undertow-jersey</artifactId>
  <version>0.1</version>

  <packaging>jar</packaging>

  <prerequisites>
    <maven>3.0</maven>
  </prerequisites>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <jersey.version>2.28</jersey.version>
    <hibernate.version>5.4.24.Final</hibernate.version>
    <activation.version>1.1.1</activation.version>
    <jaxb.version>2.3.0</jaxb.version>
  </properties>

  <profiles>
    <profile>
      <id>c3p0</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-c3p0</artifactId>
          <version>${hibernate.version}</version>
        </dependency>
      </dependencies>
      <build>
        <resources>
          <resource>
            <directory>src/main/resources/</directory>
            <includes>
              <include>fortunes.mustache</include>
              <include>META-INF/persistence.xml</include>
            </includes>
            <excludes>
              <exclude>hikarycp/META-INF/persistence.xml</exclude>
            </excludes>
          </resource>
        </resources>
      </build>
    </profile>
    <profile>
      <id>hikaricp</id>
      <dependencies>
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-hikaricp</artifactId>
          <version>${hibernate.version}</version>
        </dependency>
      </dependencies>
      <build>
        <resources>
          <resource>
            <directory>src/main/resources/</directory>
            <includes>
              <include>fortunes.mustache</include>
            </includes>
            <excludes>
              <exclude>META-INF/persistence.xml</exclude>
            </excludes>
          </resource>
          <resource>
            <directory>src/main/resources/hikarycp</directory>
            <includes>
              <include>META-INF/persistence.xml</include>
            </includes>
          </resource>
        </resources>
      </build>
    </profile>
  </profiles>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.glassfish.jersey</groupId>
        <artifactId>jersey-bom</artifactId>
        <version>${jersey.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-server</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
      <version>${jersey.version}</version>
      <exclusions>
          <exclusion>
          <artifactId>javax.inject</artifactId>
          <groupId>javax.inject</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.ext</groupId>
      <artifactId>jersey-mvc-mustache</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>${jersey.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>com.fasterxml.jackson.core</artifactId>
          <groupId>jackson-annotations</groupId>
        </exclusion>
        <exclusion>
          <artifactId>com.fasterxml.jackson.core</artifactId>
          <groupId>jackson-databind</groupId>
        </exclusion>
        <exclusion>
          <artifactId>com.fasterxml.jackson.module</artifactId>
          <groupId>jackson-module-jaxb-annotations</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.9.9</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.16.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-jaxb-annotations</artifactId>
      <version>2.9.9</version>
    </dependency>

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

    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.2</version>
    </dependency>

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.28</version>
    </dependency>

    <dependency>
      <groupId>io.undertow</groupId>
      <artifactId>undertow-core</artifactId>
      <version>2.3.17.Final</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <version>${jaxb.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>${activation.version}</version>
    </dependency>

  </dependencies>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <inherited>true</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <debug>false</debug>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>hello.JerseyWebServer</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
