<?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.14.16</version>
    <relativePath>../../parent</relativePath>
  </parent>
  <groupId>org.daisy.pipeline</groupId>
  <artifactId>clientlib-java-jaxb</artifactId>
  <version>3.1.0</version>
  <packaging>bundle</packaging>
  <name>DAISY Pipeline 2 :: JAXB based Java client library</name>
  <properties>
    <jersey.version>2.9</jersey.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-multipart</artifactId>
      <version>${jersey.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.2</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.scm</groupId>
              <artifactId>maven-scm-provider-gitexe</artifactId>
              <version>1.9.1</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>jaxb2-maven-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>us.bryon</groupId>
          <artifactId>relaxng-maven-plugin</artifactId>
          <version>1.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- get rnc files from webservice-utils -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-rnc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>target/generated-resources/rnc</outputDirectory>
              <resources>
                <resource>
                  <directory>../../webservice/src/main/resources/org/daisy/pipeline/webservice/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- rnc to xsd so we can generate the classes -->
      <plugin>
        <groupId>us.bryon</groupId>
        <artifactId>relaxng-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>trang</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <src>${project.basedir}/target/generated-resources/rnc</src>
        </configuration>
      </plugin>
      <!--generate the jaxb2 objects -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <configuration>
          <xjcSourceExcludeFilters>
            <filter implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
              <patterns>
                <pattern>\.rng</pattern>
              </patterns>
            </filter>
          </xjcSourceExcludeFilters>
        </configuration>
        <executions>
          <execution>
            <id>script</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <!-- "dummy.xsd" hack found at https://artofcode.wordpress.com/2019/02/26/jaxb2-maven-plugin-2-4-and-java-11 -->
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/script</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.script</packageName>
              <!--<outputDirectory>${project.basedir}/src/main/java</outputDirectory>-->
            </configuration>
          </execution>
          <execution>
            <id>base</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/base</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.base</packageName>
            </configuration>
          </execution>
          <execution>
            <id>job</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/job</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.job</packageName>
            </configuration>
          </execution>
          <execution>
            <id>queue</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/queue</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.queue</packageName>
            </configuration>
          </execution>
          <execution>
            <id>request</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/request</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.request</packageName>
            </configuration>
          </execution>
          <execution>
            <id>client</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/client</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.clients</packageName>
            </configuration>
          </execution>
          <execution>
            <id>properties</id>
            <goals>
              <goal>xjc</goal>
            </goals>
            <configuration>
              <clearOutputDir>false</clearOutputDir>
              <sources>
                <source>dummy.xsd</source>
                <source>${project.build.directory}/trang/properties</source>
              </sources>
              <packageName>org.daisy.pipeline.webservice.jaxb.properties</packageName>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <dependencies>
        <!--
            for jaxb2-maven-plugin
        -->
        <dependency>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          <version>2.3.0</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>jaxb2-maven-plugin</artifactId>
              <version>2.4</version>
              <dependencies>
                <dependency>
                  <groupId>com.sun.activation</groupId>
                  <artifactId>jakarta.activation</artifactId>
                  <version>1.2.1</version>
                </dependency>
              </dependencies>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>
