<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2016 Yahoo 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>

  <groupId>com.yahoo.athenz</groupId>
  <artifactId>athenz</artifactId>
  <packaging>pom</packaging>
  <version>1.10.9</version>

  <name>AthenZ</name>
  <description>
    Open source platform for X.509 certificate based service authentication
    and fine grained access control in dynamic infrastructures. Athenz
    supports provisioning and configuration (centralized authorization) use
    cases as well as serving/runtime (decentralized authorization) use cases.
  </description>
  <url>https://github.com/AthenZ/athenz</url>

  <organization>
    <name>Yahoo Inc.</name>
    <url>https://www.yahoo.com/</url>
  </organization>
  <inceptionYear>2016</inceptionYear>

  <developers>
    <developer>
      <name>Athenz Maintainers</name>
      <organization>Cloud Native Computing Foundation</organization>
      <organizationUrl>https://www.cncf.io/sandbox-projects/</organizationUrl>
    </developer>
  </developers>

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

  <scm>
    <url>https://github.com/AthenZ/athenz</url>
    <connection>scm:git:https://github.com/AthenZ/athenz.git</connection>
    <developerConnection>scm:git:https://github.com/AthenZ/athenz.git</developerConnection>
    <tag>v1.10.9</tag>
  </scm>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/AthenZ/athenz/issues</url>
  </issueManagement>

  <ciManagement>
    <system>Screwdriver.cd</system>
    <url>https://cd.screwdriver.cd/pipelines/6418</url>
  </ciManagement>

  <properties>
    <jetty.version>9.4.38.v20210224</jetty.version>
    <jersey.version>2.33</jersey.version>
    <jackson.core.version>2.12.2</jackson.core.version>
    <jackson.databind.version>2.12.2</jackson.databind.version>
    <jackson.annotations.version>2.12.2</jackson.annotations.version>
    <jackson.jaxrs.version>2.12.2</jackson.jaxrs.version>
    <rdl.version>1.5.4</rdl.version>
    <bouncycastle.version>1.68</bouncycastle.version>
    <aws.version>1.11.969</aws.version>
    <aws2.version>2.16.13</aws2.version>
    <guava.version>30.1-jre</guava.version>
    <logback.version>1.2.3</logback.version>
    <javax.version>3.1.0</javax.version>
    <javax.ws.version>2.1.1</javax.ws.version>
    <mockito.version>3.8.0</mockito.version>
    <jmockit.version>1.49</jmockit.version>
    <jjwt.version>0.11.2</jjwt.version>
    <jaxb.version>2.3.3</jaxb.version>
    <mysql.connector.version>8.0.23</mysql.connector.version>
    <commons.daemon.version>1.2.4</commons.daemon.version>
    <apache.httpclient.version>4.5.13</apache.httpclient.version>
    <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
    <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
    <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
    <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    <exec-maven-plugin.version>1.1.1</exec-maven-plugin.version>
    <swagger.version>2.1.7</swagger.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <code.coverage.min>0.95</code.coverage.min>
    <argLine>-Dlogback.configurationFile=src/test/resources/sd_logback.xml</argLine>
    <sonar.projectKey>AthenzSonar-${project.groupId}:${project.artifactId}</sonar.projectKey>
    <sonar.organization>athenz</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
  </properties>

  <modules>
    <module>rdl/rdl-gen-athenz-server</module>
    <module>rdl/rdl-gen-athenz-go-model</module>
    <module>rdl/rdl-gen-athenz-go-client</module>
    <module>rdl/rdl-gen-athenz-java-model</module>
    <module>core/zms</module>
    <module>core/zts</module>
    <module>libs/java/auth_core</module>
    <module>libs/java/client_common</module>
    <module>libs/java/server_common</module>
    <module>libs/java/instance_provider</module>
    <module>libs/java/cert_refresher</module>
    <module>clients/java/zms</module>
    <module>clients/java/zts/core</module>
    <module>clients/java/zts/shade</module>
    <module>clients/java/zpe</module>
    <module>servers/zms</module>
    <module>servers/zts</module>
    <module>containers/jetty</module>
    <module>clients/go/zms</module>
    <module>clients/go/zts</module>
    <module>libs/go/zmscli</module>
    <module>libs/go/zmssvctoken</module>
    <module>libs/go/athenzutils</module>
    <module>libs/go/athenzconf</module>
    <module>utils/zms-cli</module>
    <module>utils/athenz-conf</module>
    <module>utils/zms-svctoken</module>
    <module>utils/zpe_policy_updater</module>
    <module>utils/zpe-updater</module>
    <module>utils/zts-roletoken</module>
    <module>utils/zts-accesstoken</module>
    <module>utils/zts-rolecert</module>
    <module>utils/zts-svccert</module>
    <module>libs/nodejs/auth_core</module>
    <module>clients/nodejs/zts</module>
    <module>clients/nodejs/zpe</module>
    <module>ui</module>
    <module>assembly/zms</module>
    <module>assembly/zts</module>
    <module>assembly/ui</module>
    <module>assembly/utils</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <tagNameFormat>v@{project.version}</tagNameFormat>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.17</version>
        <executions>
          <execution>
            <id>validate</id>
            <phase>process-sources</phase>
            <configuration>
              <configLocation>athenz-checkstyle.xml</configLocation>
              <encoding>UTF-8</encoding>
              <consoleOutput>true</consoleOutput>
              <failsOnError>false</failsOnError>
              <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
            </configuration>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <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-plugin.version}</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <configuration>
              <source>8</source>
            </configuration>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.5</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <execution>
            <id>jacoco-check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>*Test</exclude>
                <exclude>**/*ZMSRDLGeneratedClient.class</exclude>
                <exclude>**/ZMSResources.class</exclude>
                <exclude>**/ZTSResources.class</exclude>
                <exclude>**/ZMSHandler.class</exclude>
                <exclude>**/ZTSHandler.class</exclude>
                <exclude>**/ZMSConsts.class</exclude>
                <exclude>**/FileConnection.class</exclude>
                <exclude>**/FileObjectStore.class</exclude>
              </excludes>
              <rules>
                <rules>
                  <rule>
                    <limits>
                      <limit>
                        <counter>LINE</counter>
                        <value>COVEREDRATIO</value>
                        <minimum>${code.coverage.min}</minimum>
                      </limit>
                    </limits>
                  </rule>
                </rules>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.30</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>7.4.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <profiles>
    <profile>
      <id>coverage</id>
      <properties>
        <checkstyle.skip>true</checkstyle.skip>
      </properties>
      <activation>
        <property>
          <name>coverage</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.openclover</groupId>
            <artifactId>clover-maven-plugin</artifactId>
            <version>4.3.1</version>
            <configuration>
              <jdk>1.8</jdk>
              <excludes>
                <exclude>**/*Resources.java</exclude>
              </excludes>
              <contextFilters>main,log,iflog</contextFilters>
              <methodContexts>
                <main>(.* )?public static void main\(String\[\] args\).*</main>
              </methodContexts>
              <statementContexts>
                <log>System.out.println\(.*\);</log>
                <log>LOGGER.info\(.*\);</log>
                <iflog>^if \(LOG.*.is.*Enabled\(\)\).*</iflog>
              </statementContexts>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ossrh</id>
      <properties>
        <gpg.executable>gpg</gpg.executable>
        <gpg.keyname>${env.GPG_KEYNAME}</gpg.keyname>
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
        <gpg.defaultKeyring>false</gpg.defaultKeyring>
        <gpg.homedir>${env.SD_SOURCE_DIR}/screwdriver/deploy</gpg.homedir>
        <gpg.publickeyring>pubring.gpg</gpg.publickeyring>
        <gpg.secretkeyring>secring.gpg</gpg.secretkeyring>
      </properties>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <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>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.7</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

</project>
