<?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.telicent.smart-caches.storage</groupId>
    <artifactId>parent</artifactId>
    <version>0.11.4</version>
    <packaging>pom</packaging>
    <name>Telicent Smart Caches - Storage - Parent</name>
    <parent>
        <groupId>io.telicent.smart-caches</groupId>
        <artifactId>parent</artifactId>
        <version>0.40.1</version>
    </parent>
    <description>Libraries to simplify using common storage layers across Smart Caches</description>

    <modules>
        <module>hibernate</module>
        <module>mongodb</module>
        <module>common</module>
        <module>label-stores</module>
        <module>rocksdb</module>
    </modules>

    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <name>Maven Central Snapshots</name>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <scm>
        <connection>scm:git:https://github.com/telicent-oss/smart-cache-storage</connection>
        <developerConnection>scm:git:ssh://git@github.com/telicent-oss/smart-cache-storage</developerConnection>
        <url>https://github.com/telicent-oss/smart-cache-storage</url>
        <tag>0.11.4</tag>
    </scm>

    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Telicent Developers</name>
            <email>opensource@telicent.io</email>
            <organization>Telicent Ltd</organization>
            <organizationUrl>https://telicent.io</organizationUrl>
        </developer>
    </developers>

    <properties>
        <java.version>21</java.version>
        <!-- License Plugin Configuration -->
        <!--
        Note that all submodules need to declare this appropriately as well so that the plugin can correctly find
        the header.txt file in this top directory even when run on a submodule -->
        <license.header.path>${project.basedir}</license.header.path>

        <analyze.failOnWarnings>false</analyze.failOnWarnings>

        <!-- Plugin Versions -->
        <plugin.editorconfig>0.2.0</plugin.editorconfig>
        <plugin.exec>3.4.1</plugin.exec>
        <plugin.war>3.1.0</plugin.war>

        <!-- Dependency Versions -->
        <dependency.commons-codec>1.22.0</dependency.commons-codec>
        <dependency.flyway>12.8.1</dependency.flyway>
        <dependency.h2>2.4.240</dependency.h2>
        <dependency.hibernate>7.4.1.Final</dependency.hibernate>
        <dependency.hypersistence>3.15.3</dependency.hypersistence>
        <dependency.jakarta-persistence>3.2.0</dependency.jakarta-persistence>
        <dependency.jackson3>3.2.0</dependency.jackson3>
        <dependency.jetty>12.1.10</dependency.jetty>
        <dependency.jmh>1.37</dependency.jmh>
        <dependency.mongodb>5.8.0</dependency.mongodb>
        <dependency.mongojack>6.0.0</dependency.mongojack>
        <dependency.postgres>42.7.11</dependency.postgres>
        <dependency.rocksdb>10.10.1.1</dependency.rocksdb>
        <dependency.smart-caches>0.40.1</dependency.smart-caches>

    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Dependencies from Smart Caches Core -->
            <dependency>
                <groupId>io.telicent.smart-caches</groupId>
                <artifactId>cli-core</artifactId>
                <version>${dependency.smart-caches}</version>
            </dependency>

            <dependency>
                <groupId>io.telicent.smart-caches</groupId>
                <artifactId>configurator</artifactId>
                <version>${dependency.smart-caches}</version>
            </dependency>

            <!-- Hibernate related dependencies -->
            <dependency>
                <groupId>jakarta.persistence</groupId>
                <artifactId>jakarta.persistence-api</artifactId>
                <version>${dependency.jakarta-persistence}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
                <version>${dependency.jackson}</version>
            </dependency>

            <dependency>
                <groupId>org.hibernate.orm</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${dependency.hibernate}</version>
            </dependency>

            <dependency>
                <groupId>org.hibernate.orm</groupId>
                <artifactId>hibernate-hikaricp</artifactId>
                <version>${dependency.hibernate}</version>
            </dependency>

            <dependency>
                <groupId>io.hypersistence</groupId>
                <artifactId>hypersistence-utils-hibernate-71</artifactId>
                <version>${dependency.hypersistence}</version>
            </dependency>

            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-core</artifactId>
                <version>${dependency.flyway}</version>
            </dependency>

            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-database-postgresql</artifactId>
                <version>${dependency.flyway}</version>
            </dependency>

            <!-- MongoDB related dependencies -->
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-sync</artifactId>
                <version>${dependency.mongodb}</version>
            </dependency>

            <dependency>
                <groupId>org.mongojack</groupId>
                <artifactId>mongojack</artifactId>
                <version>${dependency.mongojack}</version>
            </dependency>

            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>mongodb</artifactId>
                <version>${dependency.testcontainers}</version>
            </dependency>

            <!-- Vulnerability patches -->
            <!-- CVE-2026-1605 -->
            <dependency>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-server</artifactId>
                <version>${dependency.jetty}</version>
            </dependency>

            <dependency>
                <groupId>tools.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${dependency.jackson3}</version>
            </dependency>

        </dependencies>

    </dependencyManagement>

    <build>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${plugin.dependency}</version>
                    <configuration>
                        <ignoredUnusedDeclaredDependencies>
                            <ignoredUnusedDeclaredDependency>org.postgresql:postgresql</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>com.h2database:h2</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>org.flywaydb:flyway-database-postgresql</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>org.hibernate.orm:hibernate-hikaricp</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>com.fasterxml.jackson.core:jackson-databind</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>tools.jackson.core:jackson-databind</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>org.eclipse.jetty:jetty-server</ignoredUnusedDeclaredDependency>
                            <ignoredUnusedDeclaredDependency>ch.qos.logback:logback-classic</ignoredUnusedDeclaredDependency>
                        </ignoredUnusedDeclaredDependencies>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>go-offline</goal>
                            </goals>
                            <configuration>
                                <!--
                                When going offline don't try to resolve internal project dependencies.  This is
                                primarily only a problem when the version gets bumped.  However, in a CI/CD environment
                                this is always needed.
                                -->
                                <excludeGroupIds>io.telicent.smart-caches.storage</excludeGroupIds>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>

        </pluginManagement>

        <plugins>
            <!-- License Plugin -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${plugin.license}</version>
                <configuration>
                    <failIfMissing>true</failIfMissing>
                    <aggregate>false</aggregate>
                    <useDefaultMapping>true</useDefaultMapping>
                    <strictCheck>true</strictCheck>
                    <licenseSets>
                        <licenseSet>
                            <header>${license.header.path}/header.txt</header>
                            <excludes>
                                <exclude>header.txt</exclude>
                                <exclude>pom.xml</exclude>
                                <exclude>**/pom.xml</exclude>
                                <exclude>.github/**/*</exclude>
                                <exclude>*-code-style.xml</exclude>
                                <exclude>.editorconfig</exclude>
                                <exclude>NOTICE</exclude>

                                <!-- Config -->
                                <exclude>**/*.yml</exclude>

                                <!-- Trivy Cache -->
                                <exclude>.trivy/**</exclude>
                                <exclude>*-trivy-*</exclude>
                            </excludes>
                        </licenseSet>
                    </licenseSets>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.ec4j.maven</groupId>
                <artifactId>editorconfig-maven-plugin</artifactId>
                <version>${plugin.editorconfig}</version>
                <executions>
                    <execution>
                        <id>check</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>*-code-style.xml</exclude>
                        <exclude>docs/images/</exclude>
                        <exclude>.vscode/*</exclude>
                        <exclude>.trivy/**</exclude>
                        <exclude>*-trivy-*</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!-- delombok so we can generate Javadoc that references lombok generated types and methods -->
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.20.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                        <configuration>
                            <!--
                            Note that we aren't building from the delombok'd source, we only need it for Javadoc.  Thus
                            don't add to output directories or the compiler will complain about duplicate class files.
                            -->
                            <addOutputDirectory>false</addOutputDirectory>
                            <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
                            <outputDirectory>${project.build.directory}/delombok</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${dependency.lombok}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- Javadoc Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!--
                    Generated Javadoc from the delombok'd code as otherwise Javadoc will error if we reference any
                    generated types/methods
                    -->
                    <sourcepath>${project.build.directory}/delombok/</sourcepath>
                    <javadocVersion>${java.version}</javadocVersion>
                    <additionalJOption>-Xdoclint:all,-missing</additionalJOption>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

</project>
