<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2014 jsonwebtoken.io
  ~
  ~ 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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt-root</artifactId>
    <version>0.11.2</version>
    <name>JJWT</name>
    <description>JSON Web Token support for the JVM and Android</description>
    <packaging>pom</packaging>
    <url>https://github.com/jwtk/jjwt</url>

    <organization>
        <name>jsonwebtoken.io</name>
        <url>https://github.com/jwtk/jjwt</url>
    </organization>
    <inceptionYear>2014</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/jwtk/jjwt.git</connection>
        <developerConnection>scm:git:git@github.com:jwtk/jjwt.git</developerConnection>
        <url>git@github.com:jwtk/jjwt.git</url>
        <tag>0.11.2</tag>
    </scm>
    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/jwtk/jjwt/issues</url>
    </issueManagement>
    <ciManagement>
        <system>TravisCI</system>
        <url>https://travis-ci.org/jwtk/jjwt</url>
    </ciManagement>

    <!-- temporary fix until official release of coverall-maven-plugin with clover support -->
    <repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>bintray-jwtk-coveralls-maven-plugin</id>
            <name>bintray</name>
            <url>https://dl.bintray.com/jwtk/coveralls-maven-plugin</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>bintray-jwtk-coveralls-maven-plugin</id>
            <name>bintray-plugins</name>
            <url>https://dl.bintray.com/jwtk/coveralls-maven-plugin</url>
        </pluginRepository>
    </pluginRepositories>
    <!-- temporary fix until official release of coverall-maven-plugin with clover support -->

    <properties>

        <jjwt.root>${basedir}</jjwt.root>
        <jjwt.previousVersion>0.10.7</jjwt.previousVersion>

        <maven.jar.version>3.0.2</maven.jar.version>
        <maven.compiler.version>3.8.0</maven.compiler.version>
        <maven.javadoc.version>3.1.1</maven.javadoc.version>
        <gmavenplus.version>1.6.1</gmavenplus.version>

        <jdk.version>1.7</jdk.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <buildNumber>${user.name}-${maven.build.timestamp}</buildNumber>

        <jackson.version>2.9.10.4</jackson.version>
        <orgjson.version>20180130</orgjson.version>
        <gson.version>2.8.5</gson.version>

        <!-- Optional Runtime Dependencies: -->
        <bouncycastle.version>1.60</bouncycastle.version>

        <!-- Test Dependencies: Only required for testing when building.  Not required by users at runtime: -->
        <groovy.version>2.5.11</groovy.version>
        <logback.version>1.2.3</logback.version>
        <easymock.version>3.6</easymock.version>
        <junit.version>4.12</junit.version>
        <powermock.version>2.0.0-beta.5</powermock.version> <!-- necessary for Java 9 support -->
        <failsafe.plugin.version>2.22.0</failsafe.plugin.version>
        <surefire.plugin.version>2.22.0</surefire.plugin.version>
        <clover.version>4.2.1</clover.version>
        <clover.db>${jjwt.root}/target/clover/clover.db</clover.db>
        <surefire.argLine />

    </properties>

    <modules>
        <module>api</module>
        <module>impl</module>
        <module>extensions</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-jackson</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-orgjson</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-gson</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>${orgjson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>

            <!-- Used only during testing for PS256, PS384 and PS512 since JDK <= 10 doesn't support them: -->
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>${bouncycastle.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk15on</artifactId>
                <version>${bouncycastle.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Test Dependencies: Only required for testing when building.  Not required by users at runtime: -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>${groovy.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <version>${easymock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-easymock</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-core</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.openclover</groupId>
                    <artifactId>clover-maven-plugin</artifactId>
                    <version>${clover.version}</version>
                    <configuration>
                        <cloverDatabase>${clover.db}</cloverDatabase>
                        <!--
                        cloverDatabase>${user.home}/.clover/${project.groupId}/jjwt/clover.db</cloverDatabase>
                        <snapshot>${user.home}/.clover/${project.groupId}/jjwt/clover.snapshot</snapshot>
                        <historyDir>${user.home}/.clover/${project.groupId}/jjwt</historyDir> -->
                        <excludes>
                            <exclude>io/jsonwebtoken/lang/*</exclude>
                        </excludes>
                        <methodPercentage>100.000000%</methodPercentage>
                        <statementPercentage>100.000000%</statementPercentage>
                        <conditionalPercentage>100.000000%</conditionalPercentage>
                        <targetPercentage>100.000000%</targetPercentage>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>3.0</version>
                    <configuration>
                        <aggregate>true</aggregate>
                        <skipExistingHeaders>true</skipExistingHeaders>
                        <header>${jjwt.root}/src/license/header.txt</header>
                        <headerDefinitions>
                            <headerDefinition>${jjwt.root}/src/license/header_format.xml</headerDefinition>
                        </headerDefinitions>
                        <properties>
                            <organization.name>${project.organization.name}</organization.name>
                            <year>2019</year>
                        </properties>
                        <excludes>
                            <exclude>**/*.txt</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>**/lombok.config</exclude>
                            <exclude>**/mvnw</exclude>
                            <exclude>.gitattributes</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.10.4</version>
                    <configuration>
                        <source>${jdk.version}</source>
                    </configuration>
                </plugin>
                <plugin>
                    <!-- japicmp will scan code for binary breaking changes, Open api/target/japicmp/japicmp.html
                         for a report of the changes since ${jjwt.previousVersion} -->
                    <groupId>com.github.siom79.japicmp</groupId>
                    <artifactId>japicmp-maven-plugin</artifactId>
                    <version>0.13.1</version>
                    <configuration>
                        <oldVersion>
                            <dependency>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <version>${jjwt.previousVersion}</version>
                                <type>jar</type>
                            </dependency>
                        </oldVersion>
                        <parameter>
                            <onlyModified>true</onlyModified>
                            <breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
                            <!-- TODO: enable after 1.0 -->
                            <!-- <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>-->
                        </parameter>
                    </configuration>
                    <executions>
                        <execution>
                            <id>japicmp</id>
                            <goals>
                                <goal>cmp</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- The following plugin section is used in jjwt-jackson and jjwt-orgjson, to repackage (and verify)
                     binary compatibility with previous versions. In v0.11.0 the implementations changed packages to
                     avoid split package issues with Java 9+ see: https://github.com/jwtk/jjwt/issues/399 -->
                <!-- TODO: remove these deprecated packages and this config before v1.0 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.1</version>
                    <configuration>
                        <shadedClassifierName>deprecated</shadedClassifierName>
                        <shadedArtifactAttached>true</shadedArtifactAttached>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                        <artifactSet>
                            <includes>
                                <include>${project.groupId}:${project.artifactId}</include>
                            </includes>
                        </artifactSet>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                        </transformers>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>enforce-banned-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <searchTransitive>true</searchTransitive>
                                    <excludes>
                                        <exclude>commons-logging</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <!-- Allow for writing tests in Groovy: -->
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>${gmavenplus.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>addSources</goal>
                            <goal>addTestSources</goal>
                            <goal>generateStubs</goal>
                            <goal>compile</goal>
                            <goal>generateTestStubs</goal>
                            <goal>compileTests</goal>
                            <goal>removeStubs</goal>
                            <goal>removeTestStubs</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy</artifactId>
                        <version>${groovy.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <configuration>
                    <argLine>${surefire.argLine}</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${failsafe.plugin.version}</version>
                <configuration>
                    <includes>
                        <include>**/*IT.java</include>
                        <include>**/*IT.groovy</include>
                        <include>**/*ITCase.java</include>
                        <include>**/*ITCase.groovy</include>
                    </includes>
                    <excludes>
                        <exclude>**/*ManualIT.java</exclude>
                        <exclude>**/*ManualIT.groovy</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.openclover</groupId>
                <artifactId>clover-maven-plugin</artifactId>
                <!--
                <configuration>
                    <excludes>
                        <!- - leaving out lang as it mostly comes from other sources - ->
                        <exclude>io/jsonwebtoken/lang/*</exclude>
                    </excludes>
                    <methodPercentage>100.000000%</methodPercentage>
                    <statementPercentage>100.000000%</statementPercentage>
                    <conditionalPercentage>100.000000%</conditionalPercentage>
                    <targetPercentage>100.000000%</targetPercentage>
                </configuration>
                <executions>
                    <execution>
                        <id>clover</id>
                        <phase>test</phase>
                        <goals>
                            <goal>instrument</goal>
                            <goal>aggregate</goal>
                            <goal>clover</goal>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions> -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9.5</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <useReleaseProfile>false</useReleaseProfile>
                    <arguments>-Psonatype-oss-release -Pdocs -Psign</arguments>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <instructions>
                        <_include>-bnd.bnd</_include>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestFile>
                            ${project.build.outputDirectory}/META-INF/MANIFEST.MF
                        </manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <!-- Temporarily host coveralls SNAPSHOT with clover support locally  -->
            <plugin>
                <groupId>org.jwtk.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>4.4.0</version>
            </plugin>
            <!-- Temporarily host coveralls SNAPSHOT with clover support locally  -->

            <!-- Override OSS parent to support Java 9 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
                <dependencies>
                    <!-- Workaround for Java 9 -->
                    <dependency>
                        <groupId>commons-lang</groupId>
                        <artifactId>commons-lang</artifactId>
                        <version>2.6</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>nonJDK7</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <!-- Turn off JDK >= 8's lint checks: -->
                <additionalparam>-Xdoclint:none</additionalparam>
                <gmavenplus.version>1.8.1</gmavenplus.version>
                <easymock.version>4.2</easymock.version>
                <powermock.version>2.0.2</powermock.version>
            </properties>
        </profile>
        <profile>
            <!-- Added profile to address https://github.com/jwtk/jjwt/issues/364 -->
            <id>jdk9AndLater</id>
            <activation>
                <jdk>[1.9,)</jdk>
            </activation>
            <properties>
                <surefire.argLine>--add-opens java.base/jdk.internal.loader=ALL-UNNAMED</surefire.argLine>
            </properties>
        </profile>
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>docs</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <!-- Workaround for Java 9 -->
                            <dependency>
                                <groupId>commons-lang</groupId>
                                <artifactId>commons-lang</artifactId>
                                <version>2.6</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
