<?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>
  <parent>
    <groupId>org.squashtest.tm</groupId>
    <artifactId>squash-tm-tm</artifactId>
    <version>11.0.9.RC1</version>
  </parent>

  <artifactId>tm.web</artifactId>
  <packaging>war</packaging>
  <name>${project.groupId}.${project.artifactId}</name>
  <description>Squash TM webapp - Provides web controllers and serve the SPA statically</description>

  <properties>
    <appserver.scope>provided</appserver.scope>
    <jasperreports.outputDir>${project.build.directory}/jasperreports-plugin/reports</jasperreports.outputDir>
    <maven-war-plugin.version>3.4.0</maven-war-plugin.version>
    <provied.scope>provided</provied.scope>
    <skipITs>false</skipITs>
    <sonar.sources>src/main</sonar.sources>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.squashtest.tm</groupId>
        <artifactId>squash-tm-bom</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>com.tngtech.archunit</groupId>
      <artifactId>archunit-junit5</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-csv</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.aspect</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.bugtracker.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.campaignassistant.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.foundation</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.report.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.testautomation.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>core.wizard.api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>database.h2.fragment</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.owasp.encoder</groupId>
      <artifactId>encoder-esapi</artifactId>
    </dependency>

    <dependency>
      <groupId>org.owasp.esapi</groupId>
      <artifactId>esapi</artifactId>
      <classifier>jakarta</classifier>
    </dependency>

    <dependency>
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>${groovy.version}</version>
      <type>pom</type>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator</artifactId>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-hibernate6</artifactId>
      <exclusions>
        <exclusion>
          <groupId>jakarta.transaction</groupId>
          <artifactId>jakarta.transaction-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>jakarta.inject</groupId>
      <artifactId>jakarta.inject-api</artifactId>
    </dependency>

    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
    </dependency>

    <dependency>
      <groupId>jakarta.servlet.jsp.jstl</groupId>
      <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
    </dependency>

    <dependency>
      <groupId>jakarta.validation</groupId>
      <artifactId>jakarta.validation-api</artifactId>
    </dependency>

    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
    </dependency>

    <dependency>
      <groupId>net.sf.jasperreports</groupId>
      <artifactId>jasperreports</artifactId>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
    </dependency>

    <dependency>
      <groupId>net.htmlparser.jericho</groupId>
      <artifactId>jericho-html</artifactId>
    </dependency>

    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-api</artifactId>
    </dependency>

    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-impl</artifactId>
    </dependency>

    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-jackson</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
    </dependency>

    <dependency>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-core</artifactId>
      <exclusions>
        <exclusion>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-classic</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
    </dependency>

    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-prometheus</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.report.books.requirements.editable</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.report.books.requirements.pdf</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.report.books.testcases.editable</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.report.books.testcases.pdf</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.report.qualitativecoverage</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.report.std</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>plugin.testautomation.jenkins</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <exclusions>
        <exclusion>
          <!--
      	 	Because of the Mantis plugin (more specifically, axis), we cannot
      	 	rely purely on spring-jcl because it specifically requires
      	 	org.apache.commons.logging.impl.LogFactoryImpl (which is not exposed by
      	 	spring-jcl).

      	 	So as explain in the javadoc of spring-jcl package org.apache.commons.logging.impl,
      	 	we are switching to jcl-over-slf4j (see import below).
      	  -->
          <groupId>org.springframework</groupId>
          <artifactId>spring-jcl</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-hateoas</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-oauth2-client</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-thymeleaf</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-taglibs</artifactId>
    </dependency>

    <dependency>
      <groupId>org.squashtest.tm</groupId>
      <artifactId>squashtest-tm-database</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.thymeleaf.extras</groupId>
      <artifactId>thymeleaf-extras-springsecurity6</artifactId>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>tm-front</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>tm.domain</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>tm.service</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>xml-resolver</groupId>
      <artifactId>xml-resolver</artifactId>
    </dependency>

    <dependency>
      <!--
    		jcl-over-slf4j was required after all because
    		spring-jcl wouldn't work with axis (in the mantis
    		plugin). Note : due to this we are supposed
    		to

    		Sorry, couldn't find a better place.
    	  -->
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>org.squashtest.tm.tools.unittest</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>spock-test-dependencies</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>test</scope>
    </dependency>

    <!-- ====================================
      TOMCAT OVERRIDES
    ======================================== -->

    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-core</artifactId>
      <scope>${appserver.scope}</scope>
      <exclusions>
        <!--
          re-excluding tomcat annotations as intended by Spring Boot,
          see https://github.com/spring-projects/spring-boot/issues/10133
          and https://github.com/spring-projects/spring-boot/commit/0aedd3f11de9fe2fff927d3f3c921ae40feded95

          REASON : we now rely on the official javax.annotation-api artifact
       -->
        <exclusion>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-annotations-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.tomcat.embed</groupId>
      <artifactId>tomcat-embed-jasper</artifactId>
      <!--
        See comment on tomcat.85-security.version.
        Cleanup : just remove the version clause.
      -->
      <scope>${appserver.scope}</scope>
    </dependency>

    <!-- ====================================
      /TOMCAT OVERRIDES
    ======================================== -->

    <!-- =================================================
    	DEPRECATED DEPENDENCIES

    	Jasper JSP impl
    	++++++++++++++++

    	This artifact is a relic from the former,
    	Jetty + OSGI era

    	javax.servlet.jsp stuffs are now served by
    	org.apache.tomcat.embed:tomcat-embed-jasper

    	In external deployement, the external tomcat
    	should provide it too.

      <groupId>org.eclipse.jetty.orbit</groupId>
      <artifactId>javax.servlet.jsp</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.eclipse.jetty.orbit</groupId>
          <artifactId>javax.servlet</artifactId>
        </exclusion>
      </exclusions>


    	slf4j bridge
    	+++++++++++++++++++++

    	already brought in by spring-boot-starter-logging
    	(using an implementation from apache common-logging)

	    <dependency>
	      <groupId>org.slf4j</groupId>
	      <artifactId>slf4j-log4j12</artifactId>
	      <scope>test</scope>
	    </dependency>

	    javax.el
	    +++++++++++++++++

	    provided by tomcat-embed-el

	    <dependency>
	      <groupId>org.glassfish</groupId>
	      <artifactId>javax.el</artifactId>
	    </dependency>

    ===================================================== -->

  </dependencies>
  <build>

    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <filtering>false</filtering>
        <directory>${project.basedir}/src/test/resources</directory>
      </testResource>
    </testResources>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <configuration>
            <additionalClasspathElements>
              <!-- The old webapp must be in scope to have the remaining i18n key loaded when starting app in dev mode-->
              <additionalClasspathElement>src/main/webapp</additionalClasspathElement>
              <additionalClasspathElement>target/jasperreports-plugin</additionalClasspathElement>
            </additionalClasspathElements>
          </configuration>

        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>${gmavenplus.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>com.alexnederlof</groupId>
        <artifactId>jasperreports-plugin</artifactId>
        <version>${jasperreports-plugin.version}</version>
        <configuration>
          <outputDirectory>${jasperreports.outputDir}</outputDirectory>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>${maven-war-plugin.version}</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <webResources>
            <resource>
              <!-- includes compiled reports -->
              <directory>${jasperreports.outputDir}</directory>
              <targetPath>WEB-INF/reports</targetPath>
            </resource>
          </webResources>
          <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
          <attachClasses>true</attachClasses>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <!-- Adds more source directories to the pom -->
          <execution>
            <id>add-integration-test-source</id>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <phase>generate-test-sources</phase>
            <configuration>
              <sources>
                <source>src/it/groovy</source>
              </sources>
            </configuration>
          </execution>

          <execution>
            <id>add-integration-test-resource</id>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <phase>generate-test-resources</phase>
            <configuration>
              <resources>
                <resource>
                  <directory>src/it/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>compile-integration-test</id>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <phase>pre-integration-test</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <!-- We can run ITs and skip unit tests with -DskipTests=true -->
          <skipTests>${skipITs}</skipTests>
        </configuration>

        <executions>
          <execution>
            <id>integration-tests</id>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <phase>integration-test</phase>
          </execution>
        </executions>
      </plugin>

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

      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <releaseProfiles>continuous-integration</releaseProfiles>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>intellij</id>
      <activation>
        <file>
          <exists>tm.web.iml</exists>
        </file>
      </activation>
      <properties>
        <!-- intellij requires that appserver has a runtime scope to start the app -->
        <appserver.scope>provided</appserver.scope>
      </properties>
    </profile>
  </profiles>
</project>
