<?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">
  <parent>
    <artifactId>hawtio-tests</artifactId>
    <groupId>io.hawt.tests</groupId>
    <version>3.0-M8</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>hawtio-tests-springboot</artifactId>
  <name>${project.artifactId}</name>
  <description>Hawtio :: Spring Boot 2.x E2E tests</description>
  <packaging>war</packaging>

  <properties>
    <hawtio.url>/actuator/hawtio</hawtio.url>
    <hawtio.managementPort>10001</hawtio.managementPort>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot-version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.camel.springboot</groupId>
        <artifactId>camel-spring-boot-bom</artifactId>
        <version>${camel-version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Spring Boot -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-undertow</artifactId>
      <exclusions>
        <exclusion>
          <groupId>io.undertow</groupId>
          <artifactId>undertow-websockets-jsr</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-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>com.vaadin.external.google</groupId>
          <artifactId>android-json</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.junit.jupiter</groupId>
          <artifactId>junit-jupiter-engine</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- jetty -->
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-jaas</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-http</artifactId>
    </dependency>

    <!-- hawtio -->
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-springboot</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!--
      Include hawtio-log-logback if you want to use Logs plugin with Spring Boot.
      Currently only Logback is supported.
    -->
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-log-logback</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Camel -->
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-stream-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-quartz-starter</artifactId>
    </dependency>

    <!--
      This dependency is mandatory for enabling Camel management
      via JMX / Hawtio.
    -->
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-management-starter</artifactId>
    </dependency>

    <!--
      To enable Camel plugin debugging feature, add this dependency.
    -->
    <dependency>
      <groupId>org.apache.camel.springboot</groupId>
      <artifactId>camel-debug-starter</artifactId>
    </dependency>

    <!--
      Hawtio example plugin project
      Since static resources are packaged under META-INF/resources in the JAR,
      it's enough to add this dependency to the project to load the plugin resources.
    -->
    <dependency>
      <groupId>io.hawt.examples</groupId>
      <artifactId>hawtio-example-sample-plugin</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Hawtio Test Features -->
    <dependency>
      <groupId>io.hawt.tests</groupId>
      <artifactId>hawtio-tests-features</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot-version}</version>
        <configuration>
          <mainClass>io.hawt.tests.spring.boot.SpringBootService</mainClass>
          <jvmArguments>
            -javaagent:./target/dependency/jmx_prometheus_javaagent.jar=10002:./jmx-exporter.yml
          </jvmArguments>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Downloads the Prometheus JMX exporter Java agent -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy</id>
            <phase>compile</phase>
            <goals>
              <goal>copy</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <artifactItems>
            <artifactItem>
              <groupId>io.prometheus.jmx</groupId>
              <artifactId>jmx_prometheus_javaagent</artifactId>
              <version>0.3.1</version>
              <type>jar</type>
              <destFileName>jmx_prometheus_javaagent.jar</destFileName>
            </artifactItem>
          </artifactItems>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin-version}</version>
        <configuration>
          <useSystemClassLoader>true</useSystemClassLoader>
          <useManifestOnlyJar>true</useManifestOnlyJar>
          <failIfNoTests>false</failIfNoTests>
          <systemPropertyVariables>
            <hawtio.url>${hawtio.url}</hawtio.url>
            <hawtio.managementPort>${hawtio.managementPort}</hawtio.managementPort>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
