<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2015-2020 Philip Helger (www.helger.com)
    philip[at]helger[dot]com

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.helger</groupId>
    <artifactId>phase4-parent-pom</artifactId>
    <version>0.9.11</version>
  </parent>
  <artifactId>phase4-lib</artifactId>
  <packaging>bundle</packaging>
  <name>phase4-lib</name>
  <description>AS4 common library</description>
  <url>https://github.com/phax/phase4/phase4-lib</url>
  <inceptionYear>2015</inceptionYear>
  
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  
  <dependencies>
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcmail-jdk15on</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-commons</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-xml</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-settings</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-jaxb</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-datetime</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-bc</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-scopes</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-json</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-mail</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-http</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-httpclient</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-xsds-xmldsig</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-tenancy</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-oton-app</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-oton-audit</artifactId>
    </dependency>
    <dependency>
      <groupId>com.helger</groupId>
      <artifactId>ph-oton-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.wss4j</groupId>
      <artifactId>wss4j-ws-security-dom</artifactId>
    </dependency>
    
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <build>
    <resources>
      <!-- Don't specify the targetPath because this leads to a broken JAR file 
        in combination with the bundle plugin (absolute file paths in ZIP file) -->
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/*.properties</exclude>
        </excludes>  
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Automatic-Module-Name>com.helger.phase4</Automatic-Module-Name>
            <Export-Package>com.helger.phase4.*</Export-Package>
            <Import-Package>!javax.annotation.*,*</Import-Package>
            <Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)",
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.processor)",
osgi.serviceloader; filter:="(osgi.serviceloader=com.helger.phase4.profile.IAS4ProfileRegistrarSPI)"; cardinality:=multiple; resolution:=optional</Require-Capability>
            <Provide-Capability>osgi.serviceloader; osgi.serviceloader=com.helger.commons.thirdparty.IThirdPartyModuleProviderSPI,
osgi.serviceloader; osgi.serviceloader=com.helger.xml.microdom.convert.IMicroTypeConverterRegistrarSPI</Provide-Capability>
            <!-- The latter one has precedence -->
            <Include-Resource>{maven-resources},phase4-version.properties=target/classes/phase4-version.properties</Include-Resource>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/NOTICE</exclude>
            <exclude>**/LICENSE</exclude>
            <exclude>**/*.txt</exclude>
            <exclude>**/*.jks</exclude>
            <exclude>src/main/resources/schemas/*</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.14.0</version>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <bindingDirectory>${basedir}/src/main/jaxb</bindingDirectory>
          <schemaDirectory>${basedir}/src/main/resources/schemas</schemaDirectory>
          <extension>true</extension>
          <strict>false</strict>
          <catalog>${basedir}/src/main/jaxb/catalog.txt</catalog>
          <args>
            <arg>-no-header</arg>
            <arg>-Xph-default-locale</arg>
            <arg>en_US</arg>
            <arg>-Xph-annotate</arg>
            <arg>-Xph-fields-private</arg>
            <arg>-Xph-code-quality</arg>
            <arg>-Xph-implements</arg>
            <arg>java.io.Serializable</arg>
            <arg>-Xph-equalshashcode</arg>
            <arg>-Xph-tostring</arg>
            <arg>-Xph-list-extension</arg>
            <arg>-Xph-csu</arg>
            <arg>-Xph-cloneable2</arg>
            <arg>-Xph-value-extender</arg>
          </args>
          <episodes>
            <episode>
              <groupId>com.helger</groupId>
              <artifactId>ph-xsds-xmldsig</artifactId>
            </episode>
          </episodes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.helger</groupId>
            <artifactId>ph-jaxb22-plugin</artifactId>
            <version>2.3.2.4</version>
          </dependency>
        </dependencies>
      </plugin>
      <!-- Delete the directory with only ObjectFactory 
           Source: http://stackoverflow.com/questions/32635137
      -->
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <delete dir="${basedir}/target/generated-sources/xjc/com/helger/xsds/" />
                <delete dir="${basedir}/target/generated-sources/xjc/com/helger/phase4/xlink/" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
