<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~
  ~  Copyright [ 2020 - 2024 ] Matthew Buckton
  ~  Copyright [ 2024 - 2026 ] MapsMessaging B.V.
  ~
  ~  Licensed under the Apache License, Version 2.0 with the Commons Clause
  ~  (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
  ~      https://commonsclause.com/
  ~
  ~  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>io.mapsmessaging</groupId>
  <artifactId>dynamic_storage</artifactId>
  <version>2.5.2</version>
  <packaging>jar</packaging>

  <name>Dynamic Storage</name>
  <description>A generic data store keyed by a Long</description>
  <url>http://www.mapsmessaging.io</url>

  <developers>
    <developer>
      <id>mapsmessaging</id>
      <name>MapsMessaging B.V.</name>
      <organization>MapsMessaging B.V.</organization>
      <organizationUrl>https://mapsmessaging.io/</organizationUrl>
      <roles>
        <role>developer</role>
        <role>maintainer</role>
      </roles>
      <timezone>Europe/Amsterdam</timezone>
      <properties>
        <location>Eindhoven, Netherlands</location>
      </properties>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Apache License, Version 2.0 with Commons Clause</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
    <license>
      <name>Commons Clause</name>
      <url>https://commonsclause.com/</url>
      <distribution>repo</distribution>
      <comments>Applied in conjunction with Apache 2.0 to restrict commercial sale</comments>
    </license>
  </licenses>

  <scm>
    <url>https://github.com/Maps-Messaging/dynamicStorage</url>
    <connection>scm:git:https://github.com/Maps-Messaging/dynamicStorage.git</connection>
    <developerConnection>scm:git:git@github.com:Maps-Messaging/dynamicStorage.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <nvd.api.key>${env.NVD_API_KEY}</nvd.api.key>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gpg.keyname>matthew.buckton@mapsmessaging.io</gpg.keyname>

    <runSuite>**/*Suite.class</runSuite>
    <!-- Below property indicates the pattern of the test suite -->
    <sonar.c.file.suffixes>-</sonar.c.file.suffixes>
    <sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco</sonar.coverage.jacoco.xmlReportPaths>

    <!-- Sonar-JaCoCo properties -->
    <sonar.cpp.file.suffixes>-</sonar.cpp.file.suffixes>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>

    <sonar.language>java</sonar.language>
    <sonar.objc.file.suffixes>-</sonar.objc.file.suffixes>

    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <sonar.organization>maps-messaging</sonar.organization>
    <sonar.projectKey>dynamic_storage</sonar.projectKey>

    <sonar.sources>src/main</sonar.sources>
    <sonar.test.exclusions>
      **/*Test.*,**/*IT.*, **.*JMH.*
    </sonar.test.exclusions>

  </properties>

  <profiles>
    <profile>
      <!-- Default profile for regular releases -->
      <id>release</id>
      <properties>
        <maven.deploy.skip>true</maven.deploy.skip>
      </properties>
      <dependencies>
        <dependency>
          <groupId>io.mapsmessaging</groupId>
          <artifactId>simple_logging</artifactId>
          <version>2.1.2</version>
        </dependency>
        <!-- Naturally order long collection -->
        <dependency>
          <groupId>io.mapsmessaging</groupId>
          <artifactId>naturally_ordered_long_collections</artifactId>
          <version>1.2.2</version>
        </dependency>

        <!-- Non Blocking Task Queue module -->
        <dependency>
          <groupId>io.mapsmessaging</groupId>
          <artifactId>non_block_task_scheduler</artifactId>
          <version>2.2.2</version>
        </dependency>

      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.10.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>true</autoPublish>
            </configuration>
          </plugin>

          <!-- Disable default deploy for releases -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>3.1.4</version>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>


    <profile>
      <id>snapshot</id>
      <properties>
        <gpg.skip>true</gpg.skip>
      </properties>
      <repositories>
        <repository>
          <id>maps_snapshots</id>
          <name>maps_snapshot_repository</name>
          <url>https://repository.mapsmessaging.io/repository/maps_snapshots/</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <dependencies>
        <dependency>
          <groupId>io.mapsmessaging</groupId>
          <artifactId>simple_logging</artifactId>
          <version>2.1.3-SNAPSHOT</version>
        </dependency>
        <!-- Naturally order long collection -->
        <dependency>
          <groupId>io.mapsmessaging</groupId>
          <artifactId>naturally_ordered_long_collections</artifactId>
          <version>1.2.3-SNAPSHOT</version>
        </dependency>

        <!-- Non Blocking Task Queue module -->
        <dependency>
          <groupId>io.mapsmessaging</groupId>
          <artifactId>non_block_task_scheduler</artifactId>
          <version>2.2.3-SNAPSHOT</version>
        </dependency>

      </dependencies>
    </profile>
  </profiles>

  <distributionManagement>
    <snapshotRepository>
      <id>maps_snapshots</id>
      <name>maps_snapshot_repository</name>
      <url>https://repository.mapsmessaging.io/repository/maps_snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.2.8</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
            <configuration>
              <keyname>${gpg.keyname}</keyname>
              <passphraseServerId>${gpg.keyname}</passphraseServerId>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Allow JDKs greater than 1.8 to be used by maven -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgs>
            <arg>-h</arg>
            <arg>src/main/cpp/</arg>
          </compilerArgs>
          <encoding>UTF-8</encoding>
          <source>17</source>
          <target>17</target>
        </configuration>
        <groupId>org.apache.maven.plugins</groupId>
        <version>3.15.0</version>
      </plugin>

      <!-- Setup code coverage by jacoco for our tests -->
      <plugin>
        <artifactId>jacoco-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- test code, lets not track the testing -->
            <exclude>**/*Test.*</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <!-- attached to Maven test phase -->
          <execution>
            <goals>
              <goal>report</goal>
            </goals>
            <id>report</id>
            <phase>test</phase>
          </execution>
        </executions>
        <groupId>org.jacoco</groupId>
        <version>0.8.14</version>
      </plugin>

      <!-- Setup the JUnit tests runner -->
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>@{argLine}</argLine>
          <includes>
            <include>**/*Test.java</include>
            <include>**/*IT.java</include>
          </includes>
        </configuration>
        <groupId>org.apache.maven.plugins</groupId>
        <version>3.5.5</version>
      </plugin>

      <!-- build the source jar as well -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.4.0</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- sBOM  generator -->
      <plugin>
        <groupId>org.cyclonedx</groupId>
        <artifactId>cyclonedx-maven-plugin</artifactId>
        <version>2.9.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>makeAggregateBom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- JavaDoc -->
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <charset>UTF-8</charset>
          <encoding>UTF-8</encoding>
          <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
          <outputDirectory>${project.build.directory}/site/docs</outputDirectory>
          <show>public</show>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>jar</goal>
            </goals>
            <id>attach-javadocs</id>
          </execution>
        </executions>
        <groupId>org.apache.maven.plugins</groupId>
        <version>3.12.0</version>
      </plugin>
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>12.2.2</version>
        <configuration>
          <nvdApiKey>${nvd.api.key}</nvdApiKey>
          <failBuildOnCVSS>10</failBuildOnCVSS>
          <failOnError>false</failOnError>
          <skipArtifactType>test-jar</skipArtifactType>
          <skipTestScope>true</skipTestScope>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>

    <!-- Add annotations for not null -->
    <dependency>
      <artifactId>annotations</artifactId>
      <groupId>org.jetbrains</groupId>
      <version>26.1.0</version>
    </dependency>

    <dependency>
      <artifactId>lombok</artifactId>
      <groupId>org.projectlombok</groupId>
      <version>1.18.46</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <artifactId>jsr305</artifactId>
      <groupId>com.google.code.findbugs</groupId>
      <version>3.0.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-jcs -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-jcs3-core</artifactId>
      <version>3.2.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/software.amazon.awssdk/s3 -->
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>s3</artifactId>
      <version>2.44.9</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations -->
    <dependency>
      <groupId>io.swagger.core.v3</groupId>
      <artifactId>swagger-annotations</artifactId>
      <version>2.2.50</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.21</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <version>1.5.25</version>
      <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.5.32</version>
      <scope>test</scope>
    </dependency>

    <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-access -->
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-access</artifactId>
      <version>1.5.32</version>
      <scope>test</scope>
    </dependency>

    <!-- Junit5 -->
    <dependency>
      <artifactId>junit-jupiter-engine</artifactId>
      <groupId>org.junit.jupiter</groupId>
      <scope>test</scope>
      <version>6.1.0</version>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>6.1.0</version>
      <scope>test</scope>
    </dependency>

    <!-- Java micro benchmarking -->
    <dependency>
      <artifactId>jmh-core</artifactId>
      <groupId>org.openjdk.jmh</groupId>
      <scope>test</scope>
      <version>1.37</version>
    </dependency>

    <dependency>
      <artifactId>jmh-generator-annprocess</artifactId>
      <groupId>org.openjdk.jmh</groupId>
      <scope>test</scope>
      <version>1.37</version>
    </dependency>
  </dependencies>
</project>
