<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2019-Present paseto.dev, Inc.
  ~
  ~ 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>9</version>
    </parent>

    <groupId>dev.paseto</groupId>
    <artifactId>jpaseto-root</artifactId>
    <version>0.2.0</version>
    <packaging>pom</packaging>
    <name>JPaseto</name>

    <organization>
        <name>paseto.dev</name>
        <url>https://paseto.dev</url>
    </organization>

    <inceptionYear>2019</inceptionYear>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>https://github.com/paseto-toolkit/jpaseto/blob/master/LICENSE</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/okta/${github.slug}.git</connection>
        <developerConnection>scm:git:ssh://github.com:${github.slug}.git</developerConnection>
        <url>http://github.com/${github.slug}</url>
      <tag>jpaseto-0.2.0</tag>
  </scm>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <github.slug>paseto-toolkit/jpaseto</github.slug>

        <!-- real base dir -->
        <root.dir>${session.executionRootDirectory}</root.dir>

        <groovy.version>2.5.8</groovy.version>
    </properties>

    <modules>
        <module>api</module>
        <module>impl</module>
        <module>extensions/crypto/sodium</module>
        <module>extensions/crypto/bouncy-castle</module>
        <module>extensions/json/jackson</module>
        <module>extensions/json/gson</module>
        <module>integration-tests</module>
        <module>coverage</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>dev.paseto</groupId>
                <artifactId>jpaseto-api</artifactId>
                <version>0.2.0</version>
            </dependency>
            <dependency>
                <groupId>dev.paseto</groupId>
                <artifactId>jpaseto-impl</artifactId>
                <version>0.2.0</version>
            </dependency>
            <dependency>
                <groupId>dev.paseto</groupId>
                <artifactId>jpaseto-jackson</artifactId>
                <version>0.2.0</version>
            </dependency>
            <dependency>
                <groupId>dev.paseto</groupId>
                <artifactId>jpaseto-sodium</artifactId>
                <version>0.2.0</version>
            </dependency>
            <dependency>
                <groupId>dev.paseto</groupId>
                <artifactId>jpaseto-bouncy-castle</artifactId>
                <version>0.2.0</version>
            </dependency>
            <dependency>
                <groupId>dev.paseto</groupId>
                <artifactId>jpaseto-its-sodium-jackson</artifactId>
                <scope>test</scope>
                <version>0.2.0</version>
            </dependency>

            <dependency>
                <groupId>com.google.auto.service</groupId>
                <artifactId>auto-service</artifactId>
                <version>1.0-rc6</version>
            </dependency>

            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk15on</artifactId>
                <version>1.64</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>${groovy.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>3.1.12.2</version>
                    <configuration>
                        <effort>Max</effort>
                        <threshold>Low</threshold>
                        <failOnError>true</failOnError>
                        <excludeFilterFile>${root.dir}/src/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
                        <plugins>
                            <plugin>
                                <groupId>com.h3xstream.findsecbugs</groupId>
                                <artifactId>findsecbugs-plugin</artifactId>
                                <version>1.10.1</version>
                            </plugin>
                        </plugins>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>3.12.0</version>
                    <configuration>
                        <linkXRef>false</linkXRef>
                        <rulesets>
                            <ruleset>${root.dir}/src/pmd/ruleset.xml</ruleset>
                        </rulesets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.5</version>
                    <configuration>
                        <excludes>
                            <exclude>**/jpaseto/lang/*</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>3.0</version>
                    <configuration>
                        <aggregate>true</aggregate>
                        <skipExistingHeaders>true</skipExistingHeaders>
                        <header>src/license/header.txt</header>
                        <headerDefinitions>
                            <headerDefinition>src/license/header_format.xml</headerDefinition>
                        </headerDefinitions>
                        <properties>
                            <organization.name>${project.organization.name}</organization.name>
                            <year>2019</year>
                        </properties>
                        <excludes>
                            <exclude>**/*.txt</exclude>
                            <exclude>.codacy.yml</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>**/lombok.config</exclude>
                            <exclude>**/mvnw</exclude>
                            <exclude>.gitattributes</exclude>
                            <exclude>NOTICE</exclude>
                            <exclude>**/NOTICE.template</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jasig.maven</groupId>
                    <artifactId>maven-notice-plugin</artifactId>
                    <version>1.1.0</version>
                    <configuration>
                        <fileName>NOTICE</fileName>
                        <generateChildNotices>false</generateChildNotices>
                        <noticeTemplate>src/license/NOTICE.template</noticeTemplate>
                        <licenseMapping>
                            <mapping>src/license/mapping.xml</mapping>
                        </licenseMapping>
                        <includeScopes>compile</includeScopes>
                    </configuration>
                    <dependencies>
                        <!-- needed for java 11 -->
                        <dependency>
                            <groupId>javax.xml.bind</groupId>
                            <artifactId>jaxb-api</artifactId>
                            <version>2.1</version>
                        </dependency>
                        <dependency>
                            <groupId>com.sun.xml.bind</groupId>
                            <artifactId>jaxb-core</artifactId>
                            <version>2.1.14</version>
                        </dependency>
                        <dependency>
                            <groupId>com.sun.xml.bind</groupId>
                            <artifactId>jaxb-impl</artifactId>
                            <version>2.1.14</version>
                        </dependency>
                        <dependency>
                            <groupId>com.sun.activation</groupId>
                            <artifactId>jakarta.activation</artifactId>
                            <version>1.2.1</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.0.0-M1</version>
                    <configuration>
                        <!-- do not update upstream, with a pending release. -->
                        <pushChanges>false</pushChanges>
                        <localCheckout>true</localCheckout>
                        <preparationGoals>clean verify</preparationGoals>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <tagNameFormat>jpaseto-@{version}</tagNameFormat>
                        <!-- This configuration copied from apache:apache:7 parent pom -->
                        <useReleaseProfile>false</useReleaseProfile>
                        <goals>deploy</goals>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <arguments>-Pdocs,sonatype-oss-release</arguments>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jasig.maven</groupId>
                <artifactId>maven-notice-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <!-- For unit tests: -->
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.8.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy</artifactId>
                        <version>${groovy.version}</version>
                    </dependency>
                </dependencies>
                <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>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <includes>
                        <include>**/*IT.java</include>
                        <include>**/*IT.groovy</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>prepare-agent-integration</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.8</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>sonatype-nexus-staging</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    <keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
                    <keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ci</id>
            <!-- Build the javadoc and scan the code for issues -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.1.1</version>
                    </plugin>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>check-license-headers</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>scan</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>scan</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>