<?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.eclipse.jetty.its</groupId>
    <artifactId>it-parent-pom</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>

  <groupId>org.eclipse.jetty.its.jetty-deploy-war-mojo-it</groupId>
  <artifactId>jetty-simple-project</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>Jetty :: Simple deploy war mojo test</name>

  <properties>
    <jetty.port.file>${project.build.directory}/jetty-deploy-war-port.txt</jetty.port.file>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-maven-plugin</artifactId>
      <classifier>tests</classifier>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <jetty.port.file>${jetty.port.file}</jetty.port.file>
            <maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
            <contentCheck>Bean Validation Webapp example</contentCheck>
          </systemPropertyVariables>
          <dependenciesToScan>
            <dependency>org.eclipse.jetty:jetty-maven-plugin</dependency>
          </dependenciesToScan>
          <includes>
            <include>**/*TestGetContent*</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>start-jetty</id>
            <phase>test-compile</phase>
            <goals>
              <goal>deploy-war</goal>
            </goals>
            <configuration>
              <supportedPackagings>
                <supportedPackaging>pom</supportedPackaging>
              </supportedPackagings>
              <war>${project.build.directory}/bean-validation-webapp-2.25.1.war</war>
              <nonBlocking>true</nonBlocking>
              <systemProperties>
                <systemProperty>
                  <name>jetty.port.file</name>
                  <value>${jetty.port.file}</value>
                </systemProperty>
              </systemProperties>
              <jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>load-war</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.glassfish.jersey.examples</groupId>
                  <artifactId>bean-validation-webapp</artifactId>
                  <version>2.25.1</version>
                  <type>war</type>
                  <overWrite>true</overWrite>
                  <includes>**</includes>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>jdk9+</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.eclipse.jetty</groupId>
              <artifactId>jetty-maven-plugin</artifactId>
              <dependencies>
                <dependency>
                  <groupId>javax.xml.bind</groupId>
                  <artifactId>jaxb-api</artifactId>
                  <version>2.3.0</version>
                </dependency>
              </dependencies>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>

    </profile>
  </profiles>

</project>
