<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2020-Present Okta, 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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.okta</groupId>
        <artifactId>okta-parent</artifactId>
        <version>17</version>
    </parent>

    <groupId>com.okta.cli</groupId>
    <artifactId>okta-cli-tools</artifactId>
    <version>0.3.1</version>
    <packaging>pom</packaging>

    <name>Okta CLI Tools</name>
    <description>A set of CLI tools that makes getting started with Okta even easier.</description>

    <prerequisites>
        <maven>3.5.0</maven>
    </prerequisites>

    <organization>
        <name>Okta, Inc</name>
        <url>https://developer.okta.com</url>
    </organization>

    <url>https://github.com/otkadeveloper/okta-cli-tools</url>

    <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>

        <okta.sdk.version>1.6.0</okta.sdk.version>
    </properties>

    <modules>
        <module>common</module>
        <module>maven-plugin</module>
        <!-- see below for enabling the CLI module when building with Graalvm -->
        <!-- <module>cli</module>-->
        <!-- <module>integration-tests</module> -->
        <!-- <module>coverage</module> -->
    </modules>

    <dependencyManagement>
        <dependencies>

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

            <dependency>
                <groupId>com.okta.cli</groupId>
                <artifactId>okta-cli-common</artifactId>
                <version>0.3.1</version>
            </dependency>

            <dependency>
                <groupId>com.okta.cli</groupId>
                <artifactId>okta-cli</artifactId>
                <version>0.3.1</version>
            </dependency>

            <dependency>
                <groupId>com.okta.cli</groupId>
                <artifactId>okta-cli-its</artifactId>
                <version>0.3.1</version>
            </dependency>

            <dependency>
                <groupId>com.okta</groupId>
                <artifactId>okta-maven-plugin</artifactId>
                <version>0.3.1</version>
            </dependency>

            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>28.2-jre</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>3.3.3</version>
            </dependency>
            <dependency>
                <groupId>com.github.tomakehurst</groupId>
                <artifactId>wiremock-standalone</artifactId>
                <version>2.24.1</version>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>7.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-api-mockito2</artifactId>
                <version>2.0.7</version>
            </dependency>
            <dependency>
                <groupId>org.powermock</groupId>
                <artifactId>powermock-module-testng</artifactId>
                <version>2.0.7</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.basedir}/src/main/resources-filtered</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.9.0</version>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <configuration>
                        <header>${root.dir}/src/license/header.txt</header>
                        <properties>
                            <year>2020</year>
                        </properties>
                    </configuration>
                </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>
                        <omitVisitors>CrlfLogInjectionDetector</omitVisitors>
                        <excludeFilterFile>${root.dir}/src/findbugs/findbugs-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-javadoc-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <!-- manually verify first release before automating -->
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jacoco-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>graalvm</id>
            <activation>
                <!-- There is no _easy_ way to detect if running with a GraalVM, so just assume Java 11 is GraalVM -->
                <jdk>11</jdk>
            </activation>
            <modules>
                <module>cli</module>
                <module>integration-tests</module>
                <module>coverage</module>
            </modules>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <configuration>
                            <!-- work around a SpotBugs Java 11 bug -->
                            <excludeFilterFile>${root.dir}/src/findbugs/findbugs-exclude.xml,${root.dir}/src/findbugs/findbugs-exclude-jdk11.xml</excludeFilterFile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>ci</id>
            <build>
                <plugins>
                    <!-- replace findbugs (from the parent pom) with spotbugs -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </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>
                </plugins>
            </build>
        </profile>
    </profiles>

  <scm>
    <tag>okta-cli-tools-0.3.1</tag>
  </scm>
</project>
