<?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>
    <parent>
        <groupId>org.n52</groupId>
        <artifactId>parent</artifactId>
        <version>27</version>
    </parent>
    <groupId>org.n52.sensorweb-server.db-model</groupId>
    <artifactId>db-model-parent</artifactId>
    <version>5.0.0</version>
    <name>Sensor Web Server Database Model</name>
    <packaging>pom</packaging>

    <modules>
        <module>entities</module>
        <module>mappings</module>
        <module>types</module>
    </modules>
    <organization>
        <name>52North Spatial Information Research GmbH</name>
        <url>https://52north.org</url>
    </organization>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/52North/series-hibernate.git</connection>
        <developerConnection>scm:git:https://github.com/52North/series-hibernate.git</developerConnection>
        <url>https://github.com/52North/series-hibernate</url>
        <tag>v5.0.0</tag>
    </scm>

    <properties>
        <!-- dev | ci | prod -->
        <env>dev</env>

        <!-- optional properties file -->
        <local.configFile>file:${user.home}/${project.build.finalName}.properties</local.configFile>

        <version.junit>6.1.0</version.junit>
        <hamcrest.version>3.0</hamcrest.version>
        <geotools.version>35.0</geotools.version>
        <geolatte.version>1.12</geolatte.version>
        <hibernate.version>6.6.54.Final</hibernate.version>
        <jakarta.version>3.2.0</jakarta.version>
        <version.slf4j>2.0.18</version.slf4j>
        <version.jakarta-annotation-api>3.0.0</version.jakarta-annotation-api>

        <postgresql.version>42.7.11</postgresql.version>
        <postgis.version>2025.1.1</postgis.version>
        <h2.version>2.4.240</h2.version>
        <version.java>17</version.java>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy</maven.build.timestamp.format>
        <currentYearDynamic>${maven.build.timestamp}</currentYearDynamic>
        <file.encoding>UTF-8</file.encoding>

        <!-- OpenRewrite migration tooling (only used by the 'rewrite' profile) -->
        <version.rewrite.plugin>6.41.0</version.rewrite.plugin>
        <version.rewrite.recipe.bom>3.32.0</version.rewrite.recipe.bom>
        <version.rewrite.spring>6.32.1</version.rewrite.spring>
        <version.rewrite.migrate-java>3.36.0</version.rewrite.migrate-java>
        <version.rewrite.hibernate>2.21.0</version.rewrite.hibernate>
        <version.rewrite.testing-frameworks>3.37.0</version.rewrite.testing-frameworks>
    </properties>

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

            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>db-model-entities</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>db-model-mappings</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>db-model-types</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgresql.version}</version>
            </dependency>
            <dependency>
                <groupId>net.postgis</groupId>
                <artifactId>postgis-jdbc</artifactId>
                <version>${postgis.version}</version>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${h2.version}</version>
            </dependency>

            <dependency>
                <groupId>jakarta.platform</groupId>
                <artifactId>jakarta.jakartaee-api</artifactId>
                <version>11.0.0</version>
            </dependency>
            <dependency>
                <groupId>jakarta.persistence</groupId>
                <artifactId>jakarta.persistence-api</artifactId>
                <version>3.2.0</version>
            </dependency>
            <dependency>
                <groupId>jakarta.annotation</groupId>
                <artifactId>jakarta.annotation-api</artifactId>
                <version>3.0.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>jakarta.el</groupId>
                <artifactId>jakarta.el-api</artifactId>
                <version>6.0.1</version>
            </dependency>
            <dependency>
                <groupId>jakarta.activation</groupId>
                <artifactId>jakarta.activation-api</artifactId>
                <version>2.1.1</version>
            </dependency>

            <dependency>
                <groupId>com.neovisionaries</groupId>
                <artifactId>nv-i18n</artifactId>
                <version>1.29</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.2</version>
            </dependency>

            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>2.14.2</version>
            </dependency>

            <dependency>
                <groupId>xalan</groupId>
                <artifactId>xalan</artifactId>
                <version>2.7.3</version>
                <exclusions>
                    <exclusion>
                        <!-- uses older xml-apis than other fop dependencies -->
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.geotools</groupId>
                <artifactId>gt-main</artifactId>
                <version>${geotools.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_codec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.geotools</groupId>
                <artifactId>gt-epsg-hsql</artifactId>
                <version>${geotools.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_codec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.geotools</groupId>
                <artifactId>gt-referencing</artifactId>
                <version>${geotools.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_codec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.geotools</groupId>
                <artifactId>gt-metadata</artifactId>
                <version>${geotools.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_codec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.geotools</groupId>
                <artifactId>gt-shapefile</artifactId>
                <version>${geotools.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>javax.media</groupId>
                        <artifactId>jai_codec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.locationtech.jts</groupId>
                <artifactId>jts-core</artifactId>
                <version>1.20.0</version>
                <exclusions>
                    <exclusion>
                        <!-- old version dependency causes conclicts -->
                        <groupId>xerces</groupId>
                        <artifactId>xercesImpl</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.geolatte</groupId>
                <artifactId>geolatte-geom</artifactId>
                <version>${geolatte.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-annotations</artifactId>
                <version>4.10.2</version>
                <scope>provided</scope>
            </dependency>

            <!-- Logging -->
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>1.5.34</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${version.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${version.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${version.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-nop</artifactId>
                <version>${version.slf4j}</version>
            </dependency>

            <!-- Testing -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${version.junit}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${version.junit}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.junit}</version>
                <type>pom</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest</artifactId>
                <version>${hamcrest.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <excludes>
                        <exclude>org.apache.commons:commons-collections4</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>sources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build>${git.commit.id}</Implementation-Build>
                        </manifestEntries>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <!-- <useSystemClassLoader>false</useSystemClassLoader> -->
                        <!-- see: https://stackoverflow.com/questions/53010200/maven-surefire-could-not-find-forkedbooter-class -->
                        <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Implementation-Build>${git.commit.id}</Implementation-Build>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- license headers -->
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <configuration>
                        <header>etc/license-header.txt</header>
                        <properties>
                            <year>${project.inceptionYear}-${currentYearDynamic}</year>
                        </properties>
                        <includes>
                            <include>**/src/**/*.java</include>
                        </includes>
                        <excludes>
                            <exclude>**/logback.xml</exclude>
                            <exclude>**/logback-test.xml</exclude>
                            <exclude>etc/**</exclude>
                        </excludes>
                        <strictCheck>true</strictCheck>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- dependencies' licenses -->
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <configuration>
                        <useMissingFile>true</useMissingFile>
                        <fileTemplate>etc/license-as-csv.ftl</fileTemplate>
                        <licenseMerges>
                            <licenseMerge>The Apache Software License, Version 2.0|Apache 2|Apache License, Version
                                2.0|Apache License, version 2.0|Apache Public License 2.0|AL 2.0
                            </licenseMerge>
                            <licenseMerge>Apache Software Licenses|Apache Software License|Apache License</licenseMerge>
                            <licenseMerge>GNU General Public License, v2.0|GNU GENERAL PUBLIC LICENSE Version 2, June
                                1991|GNU General Public License, Version 2.0
                            </licenseMerge>
                            <licenseMerge>Common Development and Distribution License (CDDL), version 1.0| Common
                                Development and Distribution License (CDDL) v1.0
                            </licenseMerge>
                            <licenseMerge>GNU Lesser General Public License, version 2.1|LGPL 2.1</licenseMerge>
                            <licenseMerge>Mozilla Public License version 1.1|MPL 1.1</licenseMerge>
                            <licenseMerge>Eclipse Public License, Version 1.0|Eclipse Public License (EPL), Version
                                1.0|Eclipse Public License - v 1.0
                            </licenseMerge>
                            <licenseMerge>GNU Lesser General Public Licence|LGPL</licenseMerge>
                        </licenseMerges>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- assemble licenses -->
                    <groupId>org.jasig.maven</groupId>
                    <artifactId>notice-maven-plugin</artifactId>
                    <configuration>
                        <noticeTemplate>etc/NOTICE.template</noticeTemplate>
                        <licenseMapping>
                            <param>etc/license-mappings.xml</param>
                        </licenseMapping>
                        <generateChildNotices>false</generateChildNotices>
                        <excludeScopes>
                            <excludeScopes>test</excludeScopes>
                            <excludeScopes>provided</excludeScopes>
                        </excludeScopes>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.gmaven</groupId>
                    <artifactId>groovy-maven-plugin</artifactId>
                    <configuration>
                        <source>
                            import java.util.Date
                            import java.text.MessageFormat

                            def vartimestamp = MessageFormat.format("{0,date,yyyy}", new Date())
                            project.properties['currentYearDynamic'] = vartimestamp
                        </source>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>2.21.0</version>
                    <configuration>
                        <configFile>${project.basedir}/etc/eclipse_formatter.xml</configFile>
                        <lineEnding>LF</lineEnding>
                        <sourceDirectory>${project.basedir}</sourceDirectory>
                        <includes>
                            <include>**/src/**/*.java</include>
                        </includes>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <configuration>
                        <rules>
                            <requireNoRepositories>
                                <allowedRepositories>
                                    <id>central</id>
                                    <id>geotools</id>
                                    <id>sonatype-nexus-snapshots</id>
                                </allowedRepositories>
                            </requireNoRepositories>
                        </rules>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

    </build>

    <profiles>

        <profile>
            <id>jdk8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <!-- assemble licenses -->
                            <groupId>org.jasig.maven</groupId>
                            <artifactId>maven-notice-plugin</artifactId>
                            <configuration>
                                <licenseMapping>
                                    <param>http://52north.github.io/cdn/licenses/license-mappings.xml</param>
                                </licenseMapping>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <profile>
            <id>since-jdk9</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <!-- assemble licenses -->
                            <groupId>org.jasig.maven</groupId>
                            <artifactId>maven-notice-plugin</artifactId>
                            <configuration>
                                <licenseMapping>
                                    <param>http://52north.github.io/cdn/licenses/license-mappings-jdk9.xml</param>
                                </licenseMapping>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>create-license-list</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-license-list</id>
                                <goals>
                                    <goal>aggregate-add-third-party</goal>
                                </goals>
                                <phase>generate-resources</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dependency</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>analyze-dependencies</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--
			OpenRewrite migration profile. Not active during normal builds.
			Drives the automated upgrade to Spring Framework 6 / Spring Security 6,
			Hibernate 6 and the javax -> jakarta (Jakarta EE) namespace migration,
			plus the required Java 17 baseline.

			Usage (run from the reactor root):
			  mvn -Prewrite rewrite:dryRun   # produces target/rewrite/rewrite.patch, no changes
			  mvn -Prewrite rewrite:run      # applies the changes in place
			  mvn -Prewrite rewrite:discover # lists the recipes that would run

			The active recipe is defined in rewrite.yml at the repository root.
		-->
        <profile>
            <id>rewrite</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openrewrite.maven</groupId>
                        <artifactId>rewrite-maven-plugin</artifactId>
                        <version>${version.rewrite.plugin}</version>
                        <configuration>
                            <exportDatatables>true</exportDatatables>
                            <activeRecipes>
                                <recipe>org.n52.sos.MigrateToSpring6AndJakarta</recipe>
                            </activeRecipes>
                        </configuration>
                        <dependencies>
                            <!--
                                Recipe modules. Versions are kept in sync with the
                                rewrite-recipe-bom (see version.rewrite.recipe.bom):
                                https://docs.openrewrite.org/reference/latest-versions-of-every-openrewrite-module
                                A plugin <dependencies> block does not honour an
                                imported BOM, so the versions are pinned explicitly.
                            -->
                            <dependency>
                                <groupId>org.openrewrite.recipe</groupId>
                                <artifactId>rewrite-spring</artifactId>
                                <version>${version.rewrite.spring}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.openrewrite.recipe</groupId>
                                <artifactId>rewrite-migrate-java</artifactId>
                                <version>${version.rewrite.migrate-java}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.openrewrite.recipe</groupId>
                                <artifactId>rewrite-hibernate</artifactId>
                                <version>${version.rewrite.hibernate}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.openrewrite.recipe</groupId>
                                <artifactId>rewrite-testing-frameworks</artifactId>
                                <version>${version.rewrite.testing-frameworks}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>central</id>
            <name>Maven Central</name>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
        <repository>
            <id>geotools</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>https://repo.osgeo.org/repository/release/</url>
        </repository>
        <repository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>
