<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2017 Okta
  ~
  ~ 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>com.okta</groupId>
        <artifactId>okta-parent</artifactId>
        <version>21</version>
    </parent>

    <groupId>com.okta.sdk</groupId>
    <artifactId>okta-sdk-root</artifactId>
    <version>8.1.0</version>
    <packaging>pom</packaging>

    <name>Okta Java SDK</name>
    <description>Okta SDK for Java</description>
    <url>https://github.com/okta/okta-sdk-java</url>
    <inceptionYear>2017</inceptionYear>

    <properties>
        <swagger-annotations.version>1.5.8</swagger-annotations.version>
        <jackson.version>2.13.0</jackson.version>
        <snakeyaml.version>1.29</snakeyaml.version>
        <bouncycastle.version>1.70</bouncycastle.version>
        <jjwt.version>0.11.1</jjwt.version>
        <okta.sdk.previousVersion>7.0.0</okta.sdk.previousVersion>
        <okta.commons.version>1.3.0</okta.commons.version>

        <github.slug>okta/okta-sdk-java</github.slug>
        <npm.exec.skip>false</npm.exec.skip> <!-- Set it to `true` to skip openAPI spec regeneration -->
    </properties>


    <modules>
        <module>swagger-templates</module>
        <module>api</module>
        <module>impl</module>
        <module>httpclients/httpclient</module>
        <module>httpclients/okhttp</module>
        <module>integration-tests</module>
        <module>examples</module>
        <module>coverage</module>
    </modules>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <!-- Inter project dependencies -->
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-sdk-api</artifactId>
                <version>8.1.0</version>
            </dependency>
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-sdk-impl</artifactId>
                <version>8.1.0</version>
            </dependency>
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-api-swagger-templates</artifactId>
                <version>8.1.0</version>
            </dependency>
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-sdk-httpclient</artifactId>
                <version>8.1.0</version>
            </dependency>
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-sdk-okhttp</artifactId>
                <version>8.1.0</version>
            </dependency>

            <!-- Other Okta Projects -->
            <dependency>
                <groupId>com.okta.commons</groupId>
                <artifactId>okta-config-check</artifactId>
                <version>${okta.commons.version}</version>
            </dependency>
            <dependency>
                <groupId>com.okta.commons</groupId>
                <artifactId>okta-commons-lang</artifactId>
                <version>${okta.commons.version}</version>
            </dependency>
            <dependency>
                <groupId>com.okta.commons</groupId>
                <artifactId>okta-http-api</artifactId>
                <version>${okta.commons.version}</version>
            </dependency>
            <dependency>
                <groupId>com.okta.commons</groupId>
                <artifactId>okta-http-httpclient</artifactId>
                <version>${okta.commons.version}</version>
            </dependency>
            <dependency>
                <groupId>com.okta.commons</groupId>
                <artifactId>okta-http-okhttp</artifactId>
                <version>${okta.commons.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>1.3.2</version>
            </dependency>

            <!-- ITs -->
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-sdk-integration-tests</artifactId>
                <version>8.1.0</version>
            </dependency>

            <!-- Examples -->
            <dependency>
                <groupId>com.okta.sdk</groupId>
                <artifactId>okta-sdk-examples-quickstart</artifactId>
                <version>8.1.0</version>
            </dependency>

            <!-- Logging -->
            <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>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>1.2.10</version>
            </dependency>

            <!-- Bouncy Castle -->
            <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>

            <!-- JJWT -->
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-api</artifactId>
                <version>${jjwt.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-impl</artifactId>
                <version>${jjwt.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-jackson</artifactId>
                <version>${jjwt.version}</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>${snakeyaml.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.auto.service</groupId>
                <artifactId>auto-service</artifactId>
                <version>1.0-rc6</version>
                <optional>true</optional>
            </dependency>

            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib</artifactId>
                <version>1.6.0</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-stdlib-common</artifactId>
                <version>1.6.0</version>
            </dependency>

            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>7.0.0</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.beanshell</groupId>
                        <artifactId>bsh</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>3.1.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.6.0</version>
                    <executions>
                        <execution>
                            <id>npm install (initialize)</id>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <phase>generate-sources</phase>
                            <configuration>
                                <skip>${npm.exec.skip}</skip>
                                <executable>npm</executable>
                                <arguments>
                                    <argument>install</argument>
                                </arguments>
                            </configuration>
                        </execution>
                        <execution>
                            <id>copy to swagger</id>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <phase>generate-sources</phase>
                            <configuration>
                                <skip>${npm.exec.skip}</skip>
                                <executable>sh</executable>
                                <arguments>
                                    <argument>-c</argument>
                                    <argument>mkdir -p ${project.basedir}/../src/swagger &amp;&amp; cp ${project.basedir}/../node_modules/@okta/openapi/dist/spec.yaml ${project.basedir}/../src/swagger/api.yaml</argument>
                                </arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <trimStackTrace>false</trimStackTrace>
                        <reuseForks>true</reuseForks>
                        <forkCount>1</forkCount>
                        <parallel>classesAndMethods</parallel>
                        <threadCount>5</threadCount>
                        <skipTests>${skipImplTests}</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <configuration>
                        <trimStackTrace>false</trimStackTrace>
                        <reuseForks>true</reuseForks>

<!--                         <forkCount>2C</forkCount>
                        <parallel>classes</parallel>
                        <threadCount>5</threadCount> -->

                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <configuration>
                        <excludeRoots>
                            <!-- exclude the generated code from PMD, Findbugs will still run -->
                            <excludeRoot>${project.build.directory}/generated-sources/swagger-codegen</excludeRoot>
                        </excludeRoots>
                        <excludes>
                            <!-- lang contains a few files copied from other projects -->
                            <exclude>**/lang/*.java</exclude>
                            <exclude>**/com/okta/sdk/impl/util/Base64.java</exclude>
                            <exclude>**/com/okta/sdk/impl/util/BaseNCodec.java</exclude>
                            <exclude>**/com/okta/sdk/impl/util/LinkedCaseInsensitiveMap</exclude>
                            <!-- caching needs a little work -->
                            <exclude>**/com/okta/sdk/impl/ds/cache/WriteCacheFilter.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <configuration>
                        <!-- exclude generated enums coverage -->
                        <excludes>
                            <exclude>**/com/okta/sdk/resource/**/*</exclude>
                            <exclude>**/quickstart/**/*</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.zalando.maven.plugins</groupId>
                    <artifactId>swagger-codegen-maven-plugin</artifactId>
                    <version>0.5.0-beta-1</version>
                    <configuration>
                        <!-- This is relative to a direct sub module -->
                        <apiFile>${project.basedir}/../src/swagger/api.yaml</apiFile>
                        <additionalProperties>
                            <apiFile>${project.basedir}/../src/swagger/api.yaml</apiFile>
                        </additionalProperties>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.okta.sdk</groupId>
                            <artifactId>okta-api-swagger-templates</artifactId>
                            <version>8.1.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.8.1</version>
                    <configuration>
                        <generateBackupPoms>false</generateBackupPoms>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.github.siom79.japicmp</groupId>
                    <artifactId>japicmp-maven-plugin</artifactId>
                    <version>0.15.4</version>
                    <configuration>
                        <oldVersion>
                            <dependency>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <version>${okta.sdk.previousVersion}</version>
                                <type>jar</type>
                            </dependency>
                        </oldVersion>
                        <parameter>
                            <onlyModified>true</onlyModified>
                            <breakBuildOnBinaryIncompatibleModifications>false</breakBuildOnBinaryIncompatibleModifications> <!-- TODO: revert to true after 6.0.0 major release -->
                            <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
                            <postAnalysisScript>${root.dir}/src/japicmp/postAnalysisScript.groovy</postAnalysisScript>
                        </parameter>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.okta</groupId>
                    <artifactId>okta-code-snippet-maven-plugin</artifactId>
                    <configuration>
                        <sourceFile>examples/quickstart/src/main/java/quickstart/ReadmeSnippets.java</sourceFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <configuration>
                        <!-- no js is used in this project -->
                        <retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jasig.maven</groupId>
                <artifactId>maven-notice-plugin</artifactId>
                <inherited>false</inherited>
                <configuration>
                    <noticeTemplate>${root.dir}/src/license/NOTICE.template</noticeTemplate>
                    <licenseMapping>
                        <mapping>${root.dir}/src/license/mapping.xml</mapping>
                    </licenseMapping>
                </configuration>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>pub-docs</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.okta</groupId>
                        <artifactId>okta-doclist-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jxr-plugin</artifactId>
                        <configuration>
                            <sourcePath>${project.build.sourceDirectory};${root.dir}/api/target/generated-sources/swagger-codegen;${root.dir}/impl/target/generated-sources/swagger-codegen</sourcePath>
                            <excludes>**/com/okta/swagger/**</excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

  <scm>
    <tag>okta-sdk-root-8.1.0</tag>
  </scm>
</project>
