<?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.jetty-run-forked-mojo-it</groupId>
    <artifactId>jetty-simple-project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>

  <artifactId>jetty-simple-webapp</artifactId>
  <packaging>war</packaging>

  <name>Jetty :: Simple :: Webapp</name>

  <properties>
    <jetty.jvmArgs>@jetty.jvmArgs@</jetty.jvmArgs>
    <jetty.port.file>${project.build.directory}/jetty-run-forked-port.txt</jetty.port.file>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.eclipse.jetty.its.jetty-run-forked-mojo-it</groupId>
      <artifactId>jetty-simple-base</artifactId>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <scope>provided</scope>
    </dependency>

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

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <jetty.port.file>${jetty.port.file}</jetty.port.file>
            <pingServlet>true</pingServlet>
            <helloServlet>true</helloServlet>
            <maven.it.name>${project.groupId}:${project.artifactId}</maven.it.name>
          </systemPropertyVariables>
          <dependenciesToScan>
            <dependency>org.eclipse.jetty:jetty-maven-plugin</dependency>
          </dependenciesToScan>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <configuration>
          <stopPort>@jetty.stopPort@</stopPort>
          <stopKey>@jetty.stopKey@</stopKey>
        </configuration>
        <executions>
          <execution>
            <id>start-jetty</id>
            <phase>test-compile</phase>
            <goals>
              <goal>run-forked</goal>
            </goals>
            <configuration>
              <nonBlocking>true</nonBlocking>
              <waitForChild>false</waitForChild>
              <jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
              <jvmArgs>${jetty.jvmArgs}</jvmArgs>
              <jettyProperties>
                <jettyProperty>jetty.port.file=${jetty.port.file}</jettyProperty>
              </jettyProperties>
            </configuration>
          </execution>
          <!--
          <execution>
            <id>stop-jetty</id>
            <phase>test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
          -->
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
