<?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.daisy.pipeline</groupId>
    <artifactId>framework-parent</artifactId>
    <version>1.15.4</version>
    <relativePath>../parent</relativePath>
  </parent>

  <artifactId>webservice</artifactId>
  <version>3.8.0</version>
  <packaging>bundle</packaging>

  <name>DAISY Pipeline 2 :: Web Service</name>

  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.libs</groupId>
      <artifactId>jing</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.restlet.osgi</groupId>
      <artifactId>org.restlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.restlet.osgi</groupId>
      <artifactId>org.restlet.ext.fileupload</artifactId>
    </dependency>
    <dependency>
      <groupId>org.restlet.osgi</groupId>
      <artifactId>org.restlet.ext.xml</artifactId>
    </dependency>
    <dependency>
      <groupId>org.restlet.osgi</groupId>
      <artifactId>org.restlet.ext.json</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.libs</groupId>
      <artifactId>servlet-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.websocket</groupId>
      <artifactId>javax-websocket-server-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>common-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>framework-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>xproc-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>ds-to-spi-runtime</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
    </dependency>
    <!--
        test dependencies
    -->
    <dependency>
      <groupId>org.daisy.libs</groupId>
      <artifactId>saxon-he</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>framework-persistence</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>persistence-derby</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>calabash-adapter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline.build</groupId>
      <artifactId>modules-test-helper</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.ops4j.pax.exam</groupId>
          <artifactId>pax-exam-container-native</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-container-forked</artifactId>
      <version>4.12.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.daisy.pipeline</groupId>
      <artifactId>clientlib-java-jaxb</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>doc</directory>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.daisy.pipeline.build</groupId>
        <artifactId>ds-to-spi-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-spi-classes</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>generate-spi-classes</goal>
            </goals>
            <configuration>
              <includes>
                org.daisy.pipeline.webservice.restlet.impl.PipelineWebService
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>generate-spi-test-classes</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>generate-spi-test-classes</goal>
            </goals>
            <configuration>
              <includes>
                org.daisy.pipeline.script.impl.XProcScript_mock_error_script,
                org.daisy.pipeline.script.impl.XProcScript_mock_messages_script,
                org.daisy.pipeline.script.impl.XProcScript_mock_script,
                SleepStep$Provider
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <_dsannotations>
              org.daisy.pipeline.webservice.restlet.impl.PipelineWebService
            </_dsannotations>
            <Import-Package>!org.daisy.common.spi,*</Import-Package>
          </instructions>
          <archive>
            <manifest>
              <mainClass>org.daisy.pipeline.webservice.restlet.impl.PipelineWebService</mainClass>
            </manifest>
          </archive>
        </configuration>
        <executions>
          <execution>
            <id>bundle-before-test</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>bundle</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.ops4j.pax.exam</groupId>
        <artifactId>maven-paxexam-plugin</artifactId>
        <version>1.2.4</version>
        <executions>
          <execution>
            <id>generate-depends-file</id>
            <goals>
              <goal>generate-depends-file</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.daisy.pipeline.build</groupId>
        <artifactId>modules-build-helper</artifactId>
        <executions>
          <execution>
            <id>process-test-catalog</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>process-test-catalog</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!--<skip>true</skip>-->
          <reuseForks>false</reuseForks>
          <systemPropertyVariables>
            <pax.exam.logging>none</pax.exam.logging>
            <!--
                PaxExam tests disabled by default because they often fail due to "The forked VM
                terminated without properly saying goodbye." errors. (It is possible that it happens
                when tests are run with OSGiLessRunner too, but less likely.)
            -->
            <org.daisy.pipeline.junit.runners>OSGiLessRunner</org.daisy.pipeline.junit.runners>
          </systemPropertyVariables>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <dependencies>
        <dependency>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          <version>2.2.11</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>com.sun.activation</groupId>
          <artifactId>jakarta.activation</artifactId>
          <version>1.2.1</version>
          <scope>test</scope>
        </dependency>
        <!-- for TestPushNotifications -->
        <dependency>
          <groupId>com.sun.net.httpserver</groupId>
          <artifactId>http</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>noSkipPaxExamTests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>false</skip>
              <systemPropertyVariables>
                <org.daisy.pipeline.junit.runners>PaxExam,OSGiLessRunner</org.daisy.pipeline.junit.runners>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
