<!--
  ~ Copyright (c) 2008-2018, Hazelcast, Inc. All Rights Reserved.
  ~
  ~ 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.
  --><!--
  - 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.atlassian</groupId>
  <artifactId>nutcluster-kubernetes</artifactId>
  <version>4.0.0</version>
  <name>Kubernetes Discovery Plugin for Nutcluster</name>
  <description>Kubernetes Service Discovery for Nutcluster Discovery SPI</description>
  <url>http://bitbucket.org/atlassian/nutcluster-kubernetes</url>
  <inceptionYear>2015</inceptionYear>
  <packaging>jar</packaging>
  <scm>
    <connection>scm:git:${env.BITBUCKET_GIT_HTTP_ORIGIN}</connection>
    <url>${env.BITBUCKET_GIT_HTTP_ORIGIN}</url>
    <developerConnection>scm:git:${env.BITBUCKET_GIT_HTTP_ORIGIN}</developerConnection>
    <tag>nutcluster-kubernetes-4.0.0</tag>
  </scm>

  <parent>
    <groupId>com.atlassian.pom</groupId>
    <artifactId>closedsource-pom</artifactId>
    <version>7.0.13</version>
  </parent>

  <properties>
    <!-- needed for checkstyle/findbugs -->
    <main.basedir>${project.basedir}</main.basedir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <timestamp>${maven.build.timestamp}</timestamp>
    <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
    <jdk.version>21</jdk.version>

    <log4j.version>3.0.0-beta2</log4j.version>
    <junit.version>4.13.2</junit.version>
    <wiremock.version>2.27.2</wiremock.version>
    <hamcrest.version>1.3</hamcrest.version>
    <mockito.version>5.12.0</mockito.version>
    <powermock.version>1.7.3</powermock.version>

    <nutcluster.version>4.0.1</nutcluster.version>

    <maven.bundle.plugin.version>6.0.0</maven.bundle.plugin.version>
      <maven.jar.plugin.version>2.4</maven.jar.plugin.version>
    <maven.source.plugin.version>2.2.1</maven.source.plugin.version>
    <maven.checkstyle.plugin.version>3.2.1</maven.checkstyle.plugin.version>
    <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
    <maven.spotbugs.plugin.version>4.9.3.0</maven.spotbugs.plugin.version>
    <maven.surefire.plugin.version>3.5.3</maven.surefire.plugin.version>
    <maven.sonar.plugin.version>3.3.0.603</maven.sonar.plugin.version>
    <maven.jacoco.plugin.version>0.7.9</maven.jacoco.plugin.version>
    <maven.javadoc.plugin.version>2.9</maven.javadoc.plugin.version>
    <maven.gpg.plugin.version>3.2.4</maven.gpg.plugin.version>
    <byte-buddy.version>1.17.6</byte-buddy.version>
  </properties>

  <licenses>
    <license>
      <name>APACHE LICENSE 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
    </license>
  </licenses>

  <dependencies>
    <dependency>
      <groupId>com.atlassian</groupId>
      <artifactId>nutcluster</artifactId>
      <version>${nutcluster.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>annotations</artifactId>
      <version>3.0.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian</groupId>
      <artifactId>nutcluster</artifactId>
      <scope>test</scope>
      <version>${nutcluster.version}</version>
      <classifier>tests</classifier>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.github.tomakehurst</groupId>
      <artifactId>wiremock</artifactId>
      <version>${wiremock.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <version>${hamcrest.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.bytebuddy</groupId>
      <artifactId>byte-buddy</artifactId>
      <version>${byte-buddy.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.bytebuddy</groupId>
      <artifactId>byte-buddy-agent</artifactId>
      <version>${byte-buddy.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${maven.bundle.plugin.version}</version>
          <executions>
              <execution>
                  <id>bundle-manifest</id>
                  <phase>process-classes</phase>
                  <goals>
                      <goal>manifest</goal>
                  </goals>
                  <configuration>
                      <instructions>
                          <Export-Package>
                              com.atlassian.nutcluster.kubernetes.*
                          </Export-Package>
                          <Import-Package>
                              com.atlassian.nutcluster.config,com.atlassian.nutcluster.config.properties,
                              com.atlassian.nutcluster.spi.discovery,com.atlassian.nutcluster.core,
                              com.atlassian.nutcluster.logging,com.atlassian.nutcluster.nio, com.atlassian.nutcluster.util,
                              com.atlassian.nutcluster.internal.json,javax.net.ssl,javax.security.auth.x500,
                              javax.naming, javax.naming.directory, com.atlassian.nutcluster.spi.partitiongroup
                          </Import-Package>
                          <Fragment-Host>com.atlassian</Fragment-Host>
                      </instructions>
                  </configuration>
              </execution>
          </executions>
      </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>${maven.jar.plugin.version}</version>
            <configuration>
                <archive>
                    <index>true</index>
                    <compress>true</compress>
                    <manifest>
                        <addClasspath>false</addClasspath>
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                    </manifest>
                    <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                </archive>
            </configuration>
        </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <configuration>
          <release>${jdk.version}</release>
          <source>${jdk.version}</source>
          <target>${jdk.version}</target>
        </configuration>
      </plugin>
      <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</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven.checkstyle.plugin.version}</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>checkstyle</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <configLocation>${main.basedir}/checkstyle/checkstyle.xml</configLocation>
          <suppressionsLocation>${main.basedir}/checkstyle/suppressions.xml</suppressionsLocation>
          <headerLocation>${main.basedir}/checkstyle/ClassHeader.txt</headerLocation>
          <enableRSS>false</enableRSS>
          <linkXRef>true</linkXRef>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <failOnViolation>true</failOnViolation>
          <includeTestSourceDirectory>false</includeTestSourceDirectory>
          <enableRulesSummary>true</enableRulesSummary>
          <propertyExpansion>main.basedir=${main.basedir}</propertyExpansion>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${maven.spotbugs.plugin.version}</version>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <failOnError>true</failOnError>
          <excludeFilterFile>${main.basedir}/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <show>public</show>
          <sourceFileExcludes>
            <exclude>com/nutcluster/kubernetes/NutclusterKubernetesDiscoveryStrategyFactory.java</exclude>
          </sourceFileExcludes>
          <sourceFileIncludes>
            <include>com/nutcluster/kubernetes/*.java</include>
          </sourceFileIncludes>
          <detectJavaApiLink>true</detectJavaApiLink>
          <links>
            <link>http://docs.hazelcast.org/docs/3.7/javadoc/</link>
          </links>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>test-coverage</id>
      <properties>
        <argLine>
          -Xms128m -Xmx1G -XX:MaxPermSize=128M
          -Dhazelcast.version.check.enabled=false
          -Dhazelcast.mancenter.enabled=false
          -Dhazelcast.logging.type=none
          -Dhazelcast.test.use.network=false
        </argLine>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${maven.jacoco.plugin.version}</version>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.plugin.version}</version>
            <configuration combine.self="override">
              <includes>
                <include>**/*Test.java</include>
                <include>**/Test*.java</include>
              </includes>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <runOrder>failedfirst</runOrder>
              <argLine>
                -Xms128m -Xmx1G -XX:MaxMetaspaceSize=128M
                -Dhazelcast.phone.home.enabled=false
                -Dhazelcast.mancenter.enabled=false
                -Dhazelcast.logging.type=none
                -Dhazelcast.test.use.network=false
                --add-opens java.base/java.net=ALL-UNNAMED
              </argLine>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>${maven.sonar.plugin.version}</version>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
