<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2015-2021 Danilo Reinert
  ~
  ~ 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>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <packaging>pom</packaging>

  <groupId>io.reinert.requestor</groupId>
  <artifactId>requestor-project</artifactId>
  <version>1.0.0</version>

  <name>Requestor</name>
  <description>Request like a boss.</description>
  <inceptionYear>2014</inceptionYear>
  <url>https://github.com/reinert/requestor</url>

  <modules>
    <module>requestor</module>
  </modules>

  <properties>
    <java.version>5</java.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- Plugins -->
    <maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
    <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
    <maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
    <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
    <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
    <maven-site-plugin.version>3.9.1</maven-site-plugin.version>
    <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
    <github.version>0.12</github.version>

    <!-- GWT -->
    <gwt.version>2.9.0</gwt.version>
    <gwtjackson.version>0.15.4</gwtjackson.version>

    <!-- Java -->
    <autoservice.version>1.0.1</autoservice.version>
    <javapoet.version>1.13.0</javapoet.version>
    <checkstyle.version>7.8.2</checkstyle.version>

    <!-- Testing -->
    <junit.version>4.13.2</junit.version>
    <compile-testing.version>0.19</compile-testing.version>
    <mockito.version>3.12.4</mockito.version>
    <truth.version>1.1.2</truth.version>

    <!-- Site -->
    <rootDirectory>${basedir}</rootDirectory>
    <site.examplesDirectory>${rootDirectory}/target/site/examples</site.examplesDirectory>
    <sitePath>${project.version}</sitePath>
  </properties>

  <scm>
    <connection>scm:git:ssh://github.com/reinert/requestor.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/reinert/requestor.git</developerConnection>
    <url>https://github.com/reinert/requestor</url>
    <tag>1.0.0</tag>
  </scm>

  <issueManagement>
    <url>https://github.com/reinert/requestor/issues</url>
    <system>Github Issues</system>
  </issueManagement>

  <distributionManagement>
    <site>
      <id>github-pages-site</id>
      <name>Deployment through GitHub's site deployment plugin</name>
      <url>${sitePath}</url>
    </site>
    <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>

  <licenses>
    <license>
      <name>Apache 2</name>
      <url>https://raw.githubusercontent.com/reinert/requestor/master/LICENSE</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>reinert</id>
      <name>Danilo Reinert</name>
      <email>daniloreinert@gmail.com</email>
      <roles>
        <role>architect</role>
        <role>lead developer</role>
      </roles>
      <timezone>-3</timezone>
    </developer>
  </developers>

  <dependencyManagement>
    <dependencies>
      <!-- Custom dependencies -->
      <dependency>
        <groupId>com.github.nmorel.gwtjackson</groupId>
        <artifactId>gwt-jackson</artifactId>
        <version>${gwtjackson.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>com.squareup</groupId>
        <artifactId>javapoet</artifactId>
        <version>${javapoet.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.auto.service</groupId>
        <artifactId>auto-service</artifactId>
        <version>${autoservice.version}</version>
      </dependency>

      <!-- GWT dependencies -->
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>${gwt.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-dev</artifactId>
        <version>${gwt.version}</version>
        <scope>provided</scope>
      </dependency>

      <!-- Test dependencies -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.google.testing.compile</groupId>
        <artifactId>compile-testing</artifactId>
        <version>${compile-testing.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.google.truth</groupId>
        <artifactId>truth</artifactId>
        <version>${truth.version}</version>
        <scope>test</scope>
      </dependency>

      <!-- Tools -->
      <dependency>
        <groupId>io.reinert.requestor.tools</groupId>
        <artifactId>requestor-checkstyle</artifactId>
        <version>${project.version}</version>
        <scope>provided</scope>
        <optional>true</optional>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <maxmemory>2048</maxmemory>
            <failOnError>true</failOnError>
            <doctitle>Requestor ${project.version} API</doctitle>
            <outputDirectory>${project.build.directory}/javadoc</outputDirectory>
            <reportOutputDirectory>${project.reporting.outputDirectory}/javadoc</reportOutputDirectory>
            <excludes>
              <exclude>**/*.txt</exclude>
            </excludes>
            <header>
              <![CDATA[
                <a href="https://github.com/reinert/requestor" target="_blank">Back to Home</a>
              ]]>
            </header>
            <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
            <docletArtifact>
              <groupId>org.umlgraph</groupId>
              <artifactId>umlgraph</artifactId>
              <version>5.6.6</version>
            </docletArtifact>
            <additionalparam>-horizontal</additionalparam>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
          <configuration>
            <tagNameFormat>requestor-@{project.version}</tagNameFormat>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <useReleaseProfile>false</useReleaseProfile>
            <goals>deploy</goals>
            <arguments>-P!project,release -Dcheckstyle.skip</arguments>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.8</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>${maven-deploy-plugin.version}</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>project</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <modules>
        <module>tools</module>
        <module>requestor</module>
        <module>examples</module>
      </modules>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-checkstyle-plugin</artifactId>
              <version>${maven-checkstyle-plugin.version}</version>
              <configuration>
                <configLocation>/requestor-checkstyle.xml</configLocation>
                <suppressionsLocation>/requestor-checkstyle-suppressions.xml</suppressionsLocation>
                <propertiesLocation>/requestor-checkstyle.properties</propertiesLocation>
                <propertyExpansion>basedir=${basedir}</propertyExpansion>
                <consoleOutput>true</consoleOutput>
                <failsOnError>true</failsOnError>
                <linkXRef>false</linkXRef>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
              </configuration>
              <dependencies>
                <dependency>
                  <groupId>io.reinert.requestor.tools</groupId>
                  <artifactId>requestor-checkstyle</artifactId>
                  <version>${project.version}</version>
                </dependency>
              </dependencies>
              <executions>
                <execution>
                  <id>validate</id>
                  <phase>validate</phase>
                  <goals>
                    <goal>checkstyle</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>site</id>
      <modules>
        <module>requestor</module>
      </modules>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>${maven-site-plugin.version}</version>
              <configuration>
                <skipDeploy>true</skipDeploy>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-javadoc-plugin</artifactId>
              <executions>
                <execution>
                  <id>build-upload-javadocs</id>
                  <phase>site</phase>
                  <goals>
                    <goal>aggregate</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>com.github.github</groupId>
              <artifactId>site-maven-plugin</artifactId>
              <version>${github.version}</version>
              <inherited>false</inherited>
              <executions>
                <execution>
                  <goals>
                    <goal>site</goal>
                  </goals>
                  <phase>site-deploy</phase>
                  <configuration>
                    <server>github</server>
                    <message>Building site for Requestor ${project.version}</message>
                    <path>${project.distributionManagement.site.url}</path>
                    <merge>true</merge>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>com.github.github</groupId>
            <artifactId>site-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>examples</id>
      <modules>
        <module>examples</module>
      </modules>
      <activation>
        <property>
          <name>presite</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.6</version>
              <executions>
                <execution>
                  <id>copy-resources</id>
                  <phase>install</phase>
                  <goals>
                    <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${site.examplesDirectory}/${site.projectDirectory}</outputDirectory>
                    <resources>
                      <resource>
                        <directory>${project.basedir}/src/main/webapp</directory>
                      </resource>
                      <resource>
                        <directory>${project.build.directory}/${project.build.finalName}</directory>
                      </resource>
                    </resources>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <modules>
        <module>requestor</module>
      </modules>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</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>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <pluginRepositories>
    <pluginRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
      <layout>default</layout>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
</project>
