<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2019 Red Hat, Inc.
    This program and the accompanying materials are made
    available under the terms of the Eclipse Public License 2.0
    which is available at:

        https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0

    Contributors:
      Red Hat, Inc. - initial API and implementation

-->
<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>org.eclipse.jkube</groupId>
  <artifactId>jkube</artifactId>
  <version>1.16.0</version>
  <packaging>pom</packaging>
  <description>Eclipse JKube</description>
  <name>Eclipse JKube</name>

  <url>https://projects.eclipse.org/projects/ecd.jkube</url>

  <licenses>
    <license>
      <url>https://www.eclipse.org/legal/epl-2.0/</url>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>geeks</id>
      <name>Eclipse JKube Development Team</name>
      <email>jkube-dev@eclipse.org</email>
      <organization>Eclipse Foundation</organization>
      <organizationUrl>https://projects.eclipse.org/projects/ecd.jkube</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/eclipse/jkube.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/eclipse/jkube.git</developerConnection>
    <tag>HEAD</tag>
    <url>git://github.com/eclipse/jkube.git</url>
  </scm>

  <repositories>
    <repository>
      <id>maven-central</id>
      <url>https://repo1.maven.org/maven2/</url>
    </repository>
    <repository>
      <id>repo.gradle.org</id>
      <url>https://repo.gradle.org/gradle/libs-releases-local/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>ext.repo.gradle.org</id>
      <url>https://repo.gradle.org/gradle/ext-releases-local/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <name>Sonatype OSS Repository (Snapshots)</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <jdk.version>1.8</jdk.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <skipTests>false</skipTests>
    <version.asciidoctor-maven-plugin>2.2.4</version.asciidoctor-maven-plugin>
    <version.asciidoctorj>2.2.0</version.asciidoctorj>
    <version.assertj-core>3.24.2</version.assertj-core>
    <version.citrus>3.4.0</version.citrus>
    <version.commons-io>2.13.0</version.commons-io>
    <version.gradle>7.6.2</version.gradle>
    <version.gradle-api-maven-plugin>0.0.3</version.gradle-api-maven-plugin>
    <version.groovy>3.0.19</version.groovy>
    <version.guava>31.1-jre</version.guava>
    <version.helm-java>0.0.3</version.helm-java>
    <version.jackson>2.15.2</version.jackson>
    <version.jacoco>0.8.10</version.jacoco>
    <version.json-smart>2.5.0</version.json-smart> <!-- Transitive dependency  required by citrus -->
    <version.junit5>5.10.0</version.junit5>
    <version.kubernetes-client>6.10.0</version.kubernetes-client>
    <version.license-maven-plugin>4.2</version.license-maven-plugin>
    <version.lombok>1.18.28</version.lombok>
    <version.lombok-maven-plugin>1.18.20.0</version.lombok-maven-plugin>
    <version.maven-compiler-plugin>3.11.0</version.maven-compiler-plugin>
    <version.maven-enforcer-plugin>3.4.0</version.maven-enforcer-plugin>
    <version.maven-failsafe-plugin>3.1.2</version.maven-failsafe-plugin>
    <version.maven-gpg-plugin>3.1.0</version.maven-gpg-plugin>
    <version.maven-invoker-plugin>3.6.0</version.maven-invoker-plugin>
    <version.maven-jar-plugin>3.3.0</version.maven-jar-plugin>
    <version.maven-javadoc-plugin>3.5.0</version.maven-javadoc-plugin>
    <version.maven-plugin-plugin>3.9.0</version.maven-plugin-plugin>
    <version.maven-release-plugin>3.0.1</version.maven-release-plugin>
    <version.maven-resources-plugin>3.3.1</version.maven-resources-plugin>
    <version.maven-source-plugin>3.3.0</version.maven-source-plugin>
    <version.maven-surefire-plugin>3.1.2</version.maven-surefire-plugin>
    <version.mockito>4.6.1</version.mockito>
    <version.nexus-staging-maven-plugin>1.6.13</version.nexus-staging-maven-plugin>
    <version.plexus-component-metadata>2.1.1</version.plexus-component-metadata>
    <version.slf4j-api>1.7.36</version.slf4j-api>
    <version.sonar-maven-plugin>3.9.1.2184</version.sonar-maven-plugin>
    <version.sshd>2.9.2</version.sshd>
    <project.build.outputTimestamp>2024-02-09T10:37:08Z</project.build.outputTimestamp>
    <asciidoctor.outputHtmlDirectory>${project.build.directory}/generated-docs</asciidoctor.outputHtmlDirectory>
  </properties>

  <modules>
    <module>jkube-kit</module>
    <module>kubernetes-maven-plugin</module>
    <module>openshift-maven-plugin</module>
    <module>gradle-plugin</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.marcnuri.plugins</groupId>
          <artifactId>gradle-api-maven-plugin</artifactId>
          <version>${version.gradle-api-maven-plugin}</version>
          <extensions>true</extensions>
        </plugin>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${version.license-maven-plugin}</version>
          <configuration>
            <useDefaultExcludes>true</useDefaultExcludes>
            <aggregate>true</aggregate>
            <properties>
              <owner>Red Hat, Inc.</owner>
            </properties>
            <mapping>
              <gradle>SLASHSTAR_STYLE</gradle>
            </mapping>
            <licenseSets>
              <licenseSet>
                <header>header.txt</header>
                <excludes>
                  <exclude>.editorconfig</exclude>
                  <exclude>**/org.ops4j.pax.logging.cfg</exclude>
                  <exclude>license.txt</exclude>
                  <exclude>**/plugin</exclude>
                  <exclude>**/test-kubeconfig</exclude>
                  <exclude>**/*-services</exclude>
                  <exclude>**/*-default</exclude>
                  <exclude>**/*.adoc</exclude>
                  <exclude>**/expected-pom.xml</exclude>
                  <exclude>**/DockerfileWithChangedFileName</exclude>
                  <exclude>**/enricher</exclude>
                  <exclude>**/test/resources/**/*</exclude>
                  <exclude>**/it/src/it/*/expected/**/*</exclude>
                  <exclude>**/*.bin</exclude>
                  <exclude>**/*.dat</exclude>
                  <exclude>**/*.importorder</exclude>
                  <exclude>**/*.timestamp</exclude>
                  <exclude>**/.gitkeep</exclude>
                  <exclude>Jenkinsfile</exclude>
                  <exclude>.mvn/**/*</exclude>
                  <exclude>mvnw</exclude>
                  <exclude>mvnw.cmd</exclude>
                  <exclude>**/.gradle/**/*</exclude>
                  <exclude>**/gradle/wrapper/**/*</exclude>
                  <exclude>**/gradlew.bat</exclude>
                  <exclude>quickstarts/gradle/*/build/**/*</exclude>
                </excludes>
              </licenseSet>
            </licenseSets>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${version.maven-plugin-plugin}</version>
          <executions>
            <execution>
              <id>mojo-descriptor</id>
              <phase>process-classes</phase>
              <goals>
                <goal>descriptor</goal>
              </goals>
            </execution>
            <execution>
              <id>help-goal</id>
              <goals>
                <goal>helpmojo</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${version.maven-enforcer-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${version.maven-failsafe-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${version.maven-gpg-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${version.maven-jar-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${version.maven-javadoc-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${version.maven-release-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${version.maven-resources-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${version.maven-source-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${version.maven-surefire-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.projectlombok</groupId>
          <artifactId>lombok-maven-plugin</artifactId>
          <version>${version.lombok-maven-plugin}</version>
          <dependencies>
            <dependency>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${version.lombok}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>${version.asciidoctor-maven-plugin}</version>
          <configuration>
            <sourceDirectory>src/main/asciidoc</sourceDirectory>
            <outputDirectory>${asciidoctor.outputHtmlDirectory}</outputDirectory>
            <refreshOn>.*</refreshOn>
            <attributes>
                <icons>font</icons>
                <pagenums/>
                <version>${project.version}</version>
                <idprefix/>
                <idseparator>-</idseparator>
                <allow-uri-read>true</allow-uri-read>
                <toc>left</toc>
                <linkcss>true</linkcss>
            </attributes>
            <backend>html5</backend>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.asciidoctor</groupId>
              <artifactId>asciidoctorj</artifactId>
              <version>${version.asciidoctorj}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${version.jacoco}</version>
          <executions>
            <execution>
              <id>default-prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>default-report</id>
              <goals>
                <goal>report</goal>
              </goals>
            </execution>
            <!-- TODO: Remove once JMockit is no longer in the project -->
            <execution>
              <id>instrument</id>
              <phase>process-classes</phase>
              <goals>
                <goal>instrument</goal>
              </goals>
            </execution>
            <execution>
              <id>restore</id>
              <phase>test</phase>
              <goals>
                <goal>restore-instrumented-classes</goal>
              </goals>
            </execution>
            <!-- ///////////////////////////////////////////////////// -->
          </executions>
        </plugin>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>${version.sonar-maven-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>${version.nexus-staging-maven-plugin}</version>
          <extensions>true</extensions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>dependency-convergence</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <dependencyConvergence/>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>


  <profiles>
    <profile>
      <id>javadoc</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>delombok</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>delombok</goal>
                </goals>
                <configuration>
                  <addOutputDirectory>false</addOutputDirectory>
                  <sourceDirectory>src/main/java</sourceDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <sourcepath>
                ${project.basedir}/target/generated-sources/delombok:
                ${project.basedir}/target/generated-sources/annotations
              </sourcepath>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
     <!-- "release" profiles used for deploying with jkube -->
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <useAgent>true</useAgent>
                  <gpgArguments>
                    <arg>--batch</arg>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce-no-snapshots</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireReleaseDeps>
                      <message>No Snapshots Allowed!</message>
                    </requireReleaseDeps>
                  </rules>
                  <fail>true</fail>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>prepare-javadoc-sources</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>delombok</goal>
                </goals>
                <configuration>
                  <addOutputDirectory>false</addOutputDirectory>
                  <sourceDirectory>src/main/java</sourceDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <sourcepath>
                ${project.basedir}/target/generated-sources/delombok:
                ${project.basedir}/target/generated-sources/annotations
              </sourcepath>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Enable JaCoCo test coverage -->
    <profile>
      <id>jacoco</id>

      <dependencies>
        <!-- JaCoCo runtime must be in classpath for offline mode -->
        <dependency>
          <groupId>org.jacoco</groupId>
          <artifactId>org.jacoco.agent</artifactId>
          <version>${version.jacoco}</version>
          <classifier>runtime</classifier>
          <scope>test</scope>
        </dependency>
      </dependencies>

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

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <!-- JaCoCo runtime must know where to dump coverage: -->
                <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
              </systemPropertyVariables>
              <environmentVariables>
                <LC_ALL>en_EN.UTF-8</LC_ALL>
              </environmentVariables>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>sonar</id>
      <properties>
        <sonar.projectKey>jkubeio_jkube</sonar.projectKey>
        <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
        <sonar.organization>jkubeio</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.coverage.exclusions>**/quickstarts/**/*</sonar.coverage.exclusions>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>sonar</id>
                <phase>install</phase>
                <goals>
                  <goal>sonar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
