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

  <groupId>io.dekorate</groupId>
  <artifactId>dekorate-project</artifactId>
  <packaging>pom</packaging>
  <version>3.2.0</version>
  <name>Dekorate</name>
  <description>A collection of annotations and processors for Kubernetes</description>

  <url>https://dekorate.io</url>
  <inceptionYear>2018</inceptionYear>

  <organization>
    <name>Red Hat</name>
    <url>http://redhat.com</url>
  </organization>

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

  <!-- including A developer as it's required by the maven poms going into
    central -->
  <developers>
    <developer>
      <id>geeks</id>
      <name>Snowdrop Development Team</name>
      <organization>snowdrop</organization>
      <organizationUrl>http://snowdrop.me/</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:dekorateio/dekorate.git</connection>
    <developerConnection>scm:git:git@github.com:dekorateio/dekorate.git</developerConnection>
    <url>http://github.com/dekorateio/dekorate</url>
    <tag>3.2.0</tag>
  </scm>

  <distributionManagement>
    <repository>
      <id>oss-sonatype-staging</id>
      <name>Sonatype Staging Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
  </distributionManagement>

  <properties>
    <format.skip>false</format.skip>
    <!-- Dependencies -->
    <version.application-crd-client>1.1.1</version.application-crd-client>
    <version.commons-codec>1.10</version.commons-codec>
    <version.commons-compress>1.21</version.commons-compress>
    <version.jansi>1.18</version.jansi>
    <version.jackson>2.12.3</version.jackson>
    <version.kubernetes-client>6.3.1</version.kubernetes-client>
    <version.sundrio>0.92.1</version.sundrio>
    <version.jayway.jsonpath>2.6.0</version.jayway.jsonpath>

    <!-- Testing Dependencies -->
    <version.junit-jupiter>5.5.0</version.junit-jupiter>
    <version.junit-platform>1.4.0</version.junit-platform>
    <version.assertj>3.11.1</version.assertj>
    <!-- Other Testing Dependencies (frameworks, tools, etc) -->
    <!-- Note: Dekorate DOES NOT depend on these, just some integration tests -->
    <version.spring-boot>2.5.12</version.spring-boot>    <version.thorntail>2.5.0.Final</version.thorntail>

    <!-- Plugins -->
    <version.maven-compiler-plugin>3.8.0</version.maven-compiler-plugin>
    <version.maven-invoker-plugin>3.1.0</version.maven-invoker-plugin>
    <version.maven-failsafe-plugin>3.0.0-M3</version.maven-failsafe-plugin>
    <version.maven-surefire-plugin>3.0.0-M3</version.maven-surefire-plugin>
    <version.maven-shade-plugin>3.0.0</version.maven-shade-plugin>
    <version.maven-release-plugin>2.5.3</version.maven-release-plugin>
    <version.nexus-staging-maven-plugin>1.6.13</version.nexus-staging-maven-plugin>

    <!-- Formatting Plugins -->
    <version.formatter-maven-plugin>2.12.2</version.formatter-maven-plugin>
    <version.impsort-maven-plugin>1.6.2</version.impsort-maven-plugin>

    <!-- Release Plugins -->
    <version.maven-gpg-plugin>1.6</version.maven-gpg-plugin>
    <version.maven-enforcer-plugin>1.3.1</version.maven-enforcer-plugin>
    <version.maven-javadoc-plugin>2.10.3</version.maven-javadoc-plugin>
    <version.maven-source-plugin>2.4</version.maven-source-plugin>
    <version.groovydoc-maven-plugin>2.1</version.groovydoc-maven-plugin>

  </properties>

  <modules>
    <module>formatter</module>
    <module>templates</module>
    <module>doc</module>
    <module>core</module>
    <module>frameworks</module>
    <module>annotations</module>
    <module>testing</module>
    <module>starters</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.sundr</groupId>
        <artifactId>builder-annotations</artifactId>
        <version>${version.sundrio}</version>
        <exclusions>
          <exclusion>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>io.sundr</groupId>
        <artifactId>transform-annotations</artifactId>
        <version>${version.sundrio}</version>
        <exclusions>
          <exclusion>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>io.sundr</groupId>
        <artifactId>sundr-codegen-velocity</artifactId>
        <version>${version.sundrio}</version>
        <scope>compile</scope>
        <optional>true</optional>
      </dependency>

      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>kubernetes-client-bom</artifactId>
        <version>${version.kubernetes-client}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <!-- Compression -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-compress</artifactId>
        <version>${version.commons-compress}</version>
      </dependency>
      <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>${version.commons-codec}</version>
      </dependency>
      <!-- Serialization  -->
      <dependency>
        <groupId>com.fasterxml.jackson</groupId>
        <artifactId>jackson-bom</artifactId>
        <version>${version.jackson}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <version>${version.jayway.jsonpath}</version>
      </dependency>

      <!-- Misc -->
      <dependency>
        <groupId>org.fusesource.jansi</groupId>
        <artifactId>jansi</artifactId>
        <version>${version.jansi}</version>
      </dependency>

      <!-- Testing -->
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${version.junit-jupiter}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>${version.junit-jupiter}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>${version.junit-jupiter}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-launcher</artifactId>
        <version>${version.junit-platform}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-runner</artifactId>
        <version>${version.junit-platform}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${version.assertj}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>


  <build>
    <plugins>
      <plugin>
        <groupId>io.sundr</groupId>
        <artifactId>sundr-maven-plugin</artifactId>
        <version>${version.sundrio}</version>
        <dependencies>
          <dependency>
            <groupId>io.sundr</groupId>
            <artifactId>sundr-codegen-velocity</artifactId>
            <version>${version.sundrio}</version>
          </dependency>
        </dependencies>
        <configuration>
          <boms>
            <bom>
              <artifactId>dekorate-bom</artifactId>
              <name>Dekorate :: Bom</name>
              <properties>
                <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
              </properties>
            </bom>
            <bom>
              <artifactId>dekorate-spring-bom</artifactId>
              <name>Dekorate :: Bom :: Spring</name>
              <modules>
                <excludes>
                  <exclude>io.dekorate:*thorntail*</exclude>
                  <exclude>io.dekorate:*micronaut*</exclude>
                </excludes>
              </modules>
              <properties>
                <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
              </properties>
            </bom>
          </boms>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate-bom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${version.maven-compiler-plugin}</version>
        <configuration>
          <source>${java.source}</source>
          <target>${java.target}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>${version.maven-invoker-plugin}</version>
        <inherited>true</inherited>
        <configuration>
          <debug>false</debug>
          <projectsDirectory>src/it</projectsDirectory>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <pomIncludes>
            <pomInclude>*/pom.xml</pomInclude>
          </pomIncludes>
          <postBuildHookScript>verify</postBuildHookScript>
          <showErrors>true</showErrors>
          <streamLogs>true</streamLogs>
          <mavenOpts>-Xmx1024m</mavenOpts>
          <goals>
            <goal>clean</goal>
            <goal>install</goal>
          </goals>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
            </goals>
            <phase>install</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.maven-surefire-plugin}</version>
        <inherited>true</inherited>
        <configuration>
          <trimStackTrace>false</trimStackTrace>
          <useSystemClassLoader>false</useSystemClassLoader>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>3.0</version>
        <inherited>true</inherited>
        <configuration>
          <aggregate>true</aggregate>
          <header>header.txt</header>
          <properties>
            <owner>Red Hat, Inc.</owner>
          </properties>
          <includes>
            <include>**/*.java</include>
            <include>**/*.groovy</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
        <version>${version.formatter-maven-plugin}</version>
        <inherited>true</inherited>
        <executions>
          <execution>
            <goals>
              <goal>format</goal>
            </goals>
            <configuration>
              <configFile>code-format.xml</configFile>
              <lineEnding>LF</lineEnding>
              <skip>${format.skip}</skip>
              <encoding>UTF-8</encoding>
            </configuration>
          </execution>
        </executions>
        <dependencies>
            <dependency>
              <groupId>io.dekorate</groupId>
              <artifactId>dekorate-formatter</artifactId>
              <version>3.2.0</version>
            </dependency>
          </dependencies>
      </plugin>
      <plugin>
        <groupId>net.revelc.code</groupId>
        <artifactId>impsort-maven-plugin</artifactId>
        <version>${version.impsort-maven-plugin}</version>
        <executions>
          <execution>
            <goals>
              <goal>sort</goal>
            </goals>
            <configuration>
              <groups>java.,javax.,org.,com.</groups>
              <staticGroups>*</staticGroups>
              <skip>${format.skip}</skip>
              <removeUnused>true</removeUnused>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>gradle</id>
      <url>https://repo.gradle.org/gradle/libs-releases-local/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>gradle</id>
      <url>https://repo.gradle.org/gradle/libs-releases-local/</url>
    </pluginRepository>
  </pluginRepositories>
  <profiles>
    <profile>
      <id>release</id>
      <properties>
        <skipITs>true</skipITs>
        <format.skip>true</format.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${version.maven-gpg-plugin}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                <!-- This is necessary for gpg to not try to use the pinentry programs -->
                <gpgArguments>
                  <arg>--pinentry-mode</arg>
                  <arg>loopback</arg>
                </gpgArguments>
              </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${version.maven-enforcer-plugin}</version>
            <executions>
              <execution>
                <id>enforce-no-snapshots</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireReleaseDeps>
                      <message>No Snapshots Allowed!</message>
                    </requireReleaseDeps>
                  </rules>
                  <fail>false</fail>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${version.maven-javadoc-plugin}</version>
            <configuration>
              <includeDependencySources>${javadoc.include.deps}</includeDependencySources>
              <dependencySourceIncludes>
                <dependencySourceInclude>${javadoc.source.includes}</dependencySourceInclude>
              </dependencySourceIncludes>
              <excludePackageNames>${javadoc.package.excludes}</excludePackageNames>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalparam>${javadoc.opts}</additionalparam>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${version.maven-source-plugin}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>${version.maven-release-plugin}</version>
            <configuration>
              <autoVersionSubmodules>true</autoVersionSubmodules>
              <tagNameFormat>@{project.version}</tagNameFormat>
              <pushChanges>false</pushChanges>
              <localCheckout>true</localCheckout>
              <remoteTagging>false</remoteTagging>
              <arguments>-DskipTests=true</arguments>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${version.nexus-staging-maven-plugin}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>oss-sonatype-staging</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
              <stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jdk9</id>
      <activation>
        <jdk>[1,1.9)</jdk>
      </activation>
      <properties>
        <java.source>1.8</java.source>
        <java.target>1.8</java.target>
      </properties>
    </profile>
    <profile>
      <id>jdk11</id>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <properties>
        <java.source>11</java.source>
        <java.target>11</java.target>
      </properties>
    </profile>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>
      </properties>
    </profile>
    <profile>
      <id>with-tests</id>
      <modules>
        <module>tests</module>
      </modules>
    </profile>
    <profile>
      <id>with-examples</id>
      <modules>
        <module>examples</module>
      </modules>
    </profile>
    <profile>
      <id>with-javadoc-and-sources</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${version.maven-javadoc-plugin}</version>
            <configuration>
              <includeDependencySources>${javadoc.include.deps}</includeDependencySources>
              <dependencySourceIncludes>
                <dependencySourceInclude>${javadoc.source.includes}</dependencySourceInclude>
              </dependencySourceIncludes>
              <excludePackageNames>${javadoc.package.excludes}</excludePackageNames>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalparam>${javadoc.opts}</additionalparam>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${version.maven-source-plugin}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
