<?xml version="1.0"?>
<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>

  <artifactId>basex-api</artifactId>

  <parent>
    <groupId>org.basex</groupId>
    <artifactId>basex-parent</artifactId>
    <version>13.0-SNAPSHOT</version>
    <relativePath>..</relativePath>
  </parent>

  <properties>
    <jettyVersion>12.1.12</jettyVersion>
  </properties>

  <name>BaseX API</name>

  <dependencies>
    <dependency>
      <groupId>org.basex</groupId>
      <artifactId>basex</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>net.xqj</groupId>
      <artifactId>basex-xqj</artifactId>
    </dependency>
    <dependency>
      <groupId>org.xmldb</groupId>
      <artifactId>xmldb-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.ee10</groupId>
      <artifactId>jetty-ee10-servlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.ee10</groupId>
      <artifactId>jetty-ee10-servlets</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.ee10</groupId>
      <artifactId>jetty-ee10-webapp</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.ee10.websocket</groupId>
      <artifactId>jetty-ee10-websocket-jetty-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.websocket</groupId>
      <artifactId>jetty-websocket-jetty-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.compression</groupId>
      <artifactId>jetty-compression-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.compression</groupId>
      <artifactId>jetty-compression-gzip</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
    </dependency>
  </dependencies>

  <build>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <includeScope>compile</includeScope>
          <excludeArtifactIds>xstream</excludeArtifactIds>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>web-archives</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <!-- package the web applications of the webapp directory -->
                <zip destfile="${project.build.directory}/webapp/chat.zip"
                     basedir="${basedir}/src/main/webapp/chat"/>
                <zip destfile="${project.build.directory}/webapp/dba.zip"
                     basedir="${basedir}/src/main/webapp/dba"/>
                <zip destfile="${project.build.directory}/webapp/webdav.zip"
                     basedir="${basedir}/src/main/webapp/webdav"/>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty.ee10</groupId>
        <artifactId>jetty-ee10-maven-plugin</artifactId>
        <version>${jettyVersion}</version>
        <configuration>
          <jettyXmls>${basedir}/src/main/webapp/WEB-INF/jetty.xml</jettyXmls>
          <stopKey>keyToStopJetty</stopKey>
          <stopPort>8081</stopPort>
          <supportedPackagings>
            <supportedPackaging>jar</supportedPackaging>
          </supportedPackagings>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
