<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>no.digipost</groupId>
        <artifactId>digipost-open-super-pom</artifactId>
        <version>2</version>
    </parent>

    <artifactId>digipost-api-client-java</artifactId>
    <version>11.3</version>
    <name>Digipost API Client</name>
    <description>Java library for interacting with the Digipost REST API</description>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <bouncycastle.version>1.54</bouncycastle.version>
        <slf4j.version>1.7.26</slf4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>no.digipost</groupId>
            <artifactId>printability-validator</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>no.digipost</groupId>
            <artifactId>digipost-cache</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.6</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.11</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.6</version>
        </dependency>
        <dependency>
            <groupId>no.digipost</groupId>
            <artifactId>http-client-builder3</artifactId>
            <version>3.0.1</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.9</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>${bouncycastle.version}</version>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <version>${bouncycastle.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>co.unruly</groupId>
            <artifactId>java-8-matchers</artifactId>
            <version>1.6</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.27.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>2.27.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>nl.jqno.equalsverifier</groupId>
            <artifactId>equalsverifier</artifactId>
            <version>3.1.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.quicktheories</groupId>
            <artifactId>quicktheories</artifactId>
            <version>0.26</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>no.digipost</groupId>
            <artifactId>digg</artifactId>
            <version>0.19</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!--
                Used by no.digipost.api.client.testing, which at this point is unsupported and
                should be considered as unstable. Defining the dependency as optional to avoid
                it being included as a transitive dependency when depending on the client library.
             -->
            <groupId>io.undertow</groupId>
            <artifactId>undertow-core</artifactId>
            <version>2.0.21.Final</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>no.digipost</groupId>
            <artifactId>digipost-data-types</artifactId>
            <version>0.18.1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.3.1</version>
            <scope>runtime</scope>
        </dependency>

    </dependencies>
    
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.5.0-M1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/user-agent.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/user-agent.properties</exclude>
                </excludes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                </plugin>
                <plugin>
                    <groupId>org.jasig.maven</groupId>
                    <artifactId>maven-notice-plugin</artifactId>
                    <version>1.1.0</version>
                    <dependencies>
                        <dependency>
                            <groupId>javax.xml.bind</groupId>
                            <artifactId>jaxb-api</artifactId>
                            <version>2.3.1</version>
                        </dependency>
                        <dependency>
                            <groupId>org.glassfish.jaxb</groupId>
                            <artifactId>jaxb-runtime</artifactId>
                            <version>2.3.1</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <noticeTemplate>${project.basedir}/src/main/notice/NOTICE.template</noticeTemplate>
                        <excludeScopes>
                            <excludeScope>test</excludeScope>
                        </excludeScopes>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M3</version>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M2</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <groupId>com.github.siom79.japicmp</groupId>
                    <artifactId>japicmp-maven-plugin</artifactId>
                    <version>0.13.0</version>
                    <configuration>
                        <newVersion>
                            <file><path>${project.build.directory}/${project.build.finalName}.${project.packaging}</path></file>
                        </newVersion>
                        <parameter>
                            <onlyModified>true</onlyModified>
                            <onlyBinaryIncompatible>true</onlyBinaryIncompatible>
                            <includes>
                                <include>no.digipost</include>
                            </includes>
                            <excludes>
                                <exclude>no.digipost.api.client.internal</exclude>
                            </excludes>
                        </parameter>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <header>src/main/resources/header.txt</header>
                    <strictCheck>true</strictCheck>
                    <excludes>
                        <exclude>NOTICE</exclude>
                        <exclude>**/NOTICE.template</exclude>
                        <exclude>LICENSE*</exclude>
                        <exclude>**/*.pdf</exclude>
                        <exclude>**/*.p12</exclude>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*.xsd</exclude>
                        <exclude>**/*.jks</exclude>
                        <exclude>**/user-agent.properties</exclude>
                        <exclude>docs/**</exclude>
                        <exclude>.java-version</exclude>
                        <exclude>.mvn/maven.config</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>check-license-header</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>no.digipost.api.client.swing.DigipostSwingClient</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jasig.maven</groupId>
                <artifactId>maven-notice-plugin</artifactId>
                <executions>
                    <execution>
                        <id>check-NOTICE-file</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>analyze-only</goal>
                        </goals>
                        <configuration>
                            <failOnWarning>true</failOnWarning>
                            <ignoreNonCompile>true</ignoreNonCompile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <!-- Maven 3.3.1 is needed for .mvn/maven.config to work
                                         https://maven.apache.org/docs/3.3.1/release-notes.html -->
                                    <version>3.3.1</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>verify-whitelisted-dependencies</id>
                        <phase>test</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <!-- Exclude all except test-scope, as we do not need to whitelist dependencies only needed for buildtime testing -->
                                        <exclude>*:*:*:jar:compile</exclude>
                                        <exclude>*:*:*:jar:runtime</exclude>
                                        <exclude>*:*:*:jar:provided</exclude>
                                    </excludes>
                                    <includes>
                                        <include>org.bouncycastle:bcprov-jdk15on:${bouncycastle.version}:jar:compile</include>
                                        <include>org.bouncycastle:bcpkix-jdk15on:${bouncycastle.version}:jar:compile</include>
                                        <include>org.jvnet.mimepull:mimepull:*:jar:compile</include>
                                        <include>org.slf4j</include>
                                        <include>org.apache.pdfbox:fontbox</include>
                                        <include>org.apache.pdfbox:pdfbox</include>
                                        <include>no.digipost:printability-validator</include>
                                        <include>no.digipost:digipost-cache</include>
                                        <include>com.google.code.findbugs:jsr305:jar</include>
                                        <include>com.google.j2objc:j2objc-annotations</include>
                                        <include>org.codehaus.mojo:animal-sniffer-annotations</include>
                                        <include>com.google.errorprone:error_prone_annotations</include>
                                        <include>com.github.ben-manes.caffeine:caffeine</include>
                                        <include>no.digipost:http-client-builder3</include>
                                        <include>commons-io:commons-io</include>
                                        <include>commons-codec:commons-codec</include>
                                        <include>org.apache.commons:commons-lang3</include>
                                        <include>org.apache.httpcomponents:httpclient</include>
                                        <include>org.apache.httpcomponents:httpcore</include>
                                        <include>org.apache.httpcomponents:httpmime</include>
                                        <include>io.undertow:undertow-core</include>
                                        <include>org.jboss.logging:jboss-logging</include>
                                        <include>org.jboss.xnio:xnio-api</include>
                                        <include>org.jboss.xnio:xnio-nio</include>
                                        <include>no.digipost:digipost-data-types</include>
                                        <include>com.fasterxml.jackson.core:jackson-databind</include>
                                        <include>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</include>
                                        <include>com.fasterxml.jackson.core:jackson-annotations</include>
                                        <include>com.fasterxml.jackson.module:jackson-module-jaxb-annotations</include>
                                        <include>org.hibernate:hibernate-validator</include>
                                        <include>com.fasterxml:classmate</include>
                                        <include>org.glassfish:javax.el</include>
                                        <include>javax.validation:validation-api</include>
                                        <include>com.fasterxml.jackson.core:jackson-core</include>
                                        <include>javax.xml.bind:jaxb-api</include>
                                        <include>javax.activation:javax.activation-api</include>
                                        <include>org.glassfish.jaxb:jaxb-runtime</include>
                                        <include>org.glassfish.jaxb:txw2</include>
                                        <include>com.sun.istack:istack-commons-runtime</include>
                                        <include>com.sun.xml.fastinfoset:FastInfoset</include>
                                        <include>org.jvnet.staxex:stax-ex</include>
                                        <include>no.digipost:certificate-validator</include>
                                    </includes>
                                    <searchTransitive>true</searchTransitive>
                                    <message>Maven-avhengigheter har forandret seg. Sjekk at alle lisenser er OK før distribusjon. Husk også å oppdatere fila «NOTICE».</message>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>assembly</id>
            <activation>
                <property>
                    <name>!skipAssembly</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>appassembler-maven-plugin</artifactId>
                        <version>2.0.0</version>
                        <configuration>
                            <programs>
                                <program>
                                    <mainClass>no.digipost.api.client.swing.DigipostSwingClient</mainClass>
                                    <id>digipost-api-client</id>
                                    <platforms>
                                        <platform>windows</platform>
                                        <platform>unix</platform>
                                    </platforms>
                                </program>
                            </programs>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>assemble</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <finalName>${project.artifactId}</finalName>
                            <descriptors>
                                <descriptor>assembly.xml</descriptor>
                            </descriptors>
                            <appendAssemblyId>false</appendAssemblyId>
                            <archiverConfig>
                                <fileMode>420</fileMode>
                                <!-- 420(dec) = 644(oct) -->
                                <directoryMode>493</directoryMode>
                                <!-- 493(dec) = 755(oct) -->
                                <defaultDirectoryMode>493</defaultDirectoryMode>
                            </archiverConfig>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:git@github.com:digipost/digipost-api-client-java.git</connection>
        <developerConnection>scm:git:git@github.com:digipost/digipost-api-client-java.git</developerConnection>
        <url>scm:git:git@github.com:digipost/digipost-api-client-java</url>
        <tag>11.3</tag>
    </scm>

</project>
