<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>ch.ethz.seb</groupId>
  <artifactId>seb-server</artifactId>
  <version>${sebserver-version}-SNAPSHOT</version>
  <name>seb-server</name>
  <description>web-service for SEB maintenance and monitoring active SEB sessions</description>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
  </parent>

  <packaging>jar</packaging>

  <properties>
    <sebserver-version>0.4.0</sebserver-version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <!-- NOTE: There currently are two profiles, a default one to build on 
    Java 11 (from eclipse and command-line) and one to build still on Java 8 
    to support the Jenkins build on CI-Server that still no Java 11 installed -->
  <profiles>

    <profile>
      <id>Demo</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <properties>
        <java.version>1.8</java.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>Java 11</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <java.version>11</java.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <release>${java.version}</release>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.glassfish.jaxb</groupId>
          <artifactId>jaxb-runtime</artifactId>
          <version>2.4.0-b180830.0438</version><!--$NO-MVN-MAN-VER$ --> <!-- TODO move to stable version when available -->
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>let_reporting</id>
      <properties>
        <java.version>1.8</java.version>
      </properties>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>3.10.0</version>
            <configuration>
              <skipEmptyReport>false</skipEmptyReport>
              <failOnViolation>false</failOnViolation>
              <targetJdk>${java.version}</targetJdk>
              <linkXRef>false</linkXRef>
              <excludes>
                <exclude>**/batis/mapper/*.java</exclude>
                <exclude>**/batis/model/*.java</exclude>
                <exclude name="UselessParentheses" />
              </excludes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                  <goal>cpd-check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3.0.4</version>
            <configuration>
              <effort>Max</effort>
              <failOnError>false</failOnError>
              <threshold>Low</threshold>
              <xmlOutput>true</xmlOutput>
              <excludeFilterFile>findbugs-excludes.xml</excludeFilterFile>
            </configuration>
            <executions>
              <execution>
                <id>analyze-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.2</version>
            <configuration>
              <includes>
                <include>ch/ethz/seb/sebserver/*</include>
              </includes>
              <!-- <excludes> -->
              <!-- <exclude>ch/ethz/seb/sebserver/webservice/datalayer/batis/mapper/*</exclude> -->
              <!-- <exclude>ch/ethz/seb/sebserver/webservice/datalayer/batis/model/*</exclude> -->
              <!-- </excludes> -->
            </configuration>
            <executions>
              <execution>
                <id>default-prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- Data Base -->
    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
    </dependency>

    <!-- MyBatis -->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.4.6</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis.dynamic-sql</groupId>
      <artifactId>mybatis-dynamic-sql</artifactId>
      <version>1.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis.spring.boot</groupId>
      <artifactId>mybatis-spring-boot-starter</artifactId>
      <version>1.3.2</version>
    </dependency>
    <dependency>
      <groupId>com.github.pagehelper</groupId>
      <artifactId>pagehelper-spring-boot-starter</artifactId>
      <version>1.2.10</version>
    </dependency>

    <!-- Spring / Spring Boot -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-websocket</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-cache</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-xml</artifactId>
    </dependency>
    <!-- NOTE since org.springframework.security.oauth is not fully migrated 
      to spring-boot-starter-security we have to declare a separate version here. 
      This refers to the latest version of spring-security-oauth2 and should be 
      compatible with the overall version of spring boot SEE: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0.0-M5-Release-Notes#oauth-20-support 
      TODO: once spring-security-oauth2 is fully migrated we should be able to 
      remove this dependency -->
    <dependency>
      <groupId>org.springframework.security.oauth</groupId>
      <artifactId>spring-security-oauth2</artifactId>
      <version>[2.3.4,)</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-jwt</artifactId>
      <version>1.0.9.RELEASE</version>
    </dependency>

    <!-- Apache HTTP -->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
    </dependency>

    <!-- Eclipse RAP / RWT -->
    <dependency>
      <groupId>org.eclipse.rap</groupId>
      <artifactId>org.eclipse.rap.rwt</artifactId>
      <version>3.5.0</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.rap</groupId>
      <artifactId>org.eclipse.rap.fileupload</artifactId>
      <version>3.7.0</version>
    </dependency>

    <!-- Misc -->
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-joda</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.cryptonode.jncryptor</groupId>
      <artifactId>jncryptor</artifactId>
      <version>1.2.0</version>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

</project>