<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2025  Tim Zimmermann <tim@aglais.org>
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU Affero General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU Affero General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Affero General Public License
  ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->

<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.aglais</groupId>
    <artifactId>zms</artifactId>
    <version>1.0.6</version>
    <packaging>pom</packaging>
    <modules>
        <module>zms-api-core</module>
        <module>zms-client</module>
        <module>zms-db/core</module>
        <module>zms-db/mysql</module>
        <module>zms-desktop</module>
        <module>zms-gbif</module>
        <module>zms-i18n</module>
        <module>zms-l10n/de</module>
        <module>zms-l10n/en</module>
        <module>zms-log/core</module>
        <module>zms-log/log4j2</module>
        <module>zms-server</module>
        <module>zms-util</module>
    </modules>

    <properties>
        <maven.compiler.release>21</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.codename>Raphus cucullatus</project.codename>
        <project.classpathPrefix>libs</project.classpathPrefix>

        <!-- Dependency versions -->
        <gson.version>2.13.2</gson.version>
        <jetbrains.annotations.version>26.0.2-1</jetbrains.annotations.version>
        <jopt-simple.version>5.0.4</jopt-simple.version>
    </properties>

    <build>
        <finalName>${project.name}</finalName>
        <plugins>
            <plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <version>9.0.2</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                    <commitIdGenerationMode>full</commitIdGenerationMode>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.9.0</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.directory}/${project.classpathPrefix}
                            </outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>resolve-sources</id>
                        <goals>
                            <goal>resolve-sources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.4.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>${project.classpathPrefix}/</classpathPrefix>
                            <!--suppress UnresolvedMavenProperty -->
                            <mainClass>${project.mainClass}</mainClass>
                        </manifest>
                        <manifestEntries>
                            <!--suppress UnresolvedMavenProperty -->
                            <Implementation-Version>
                                ${project.version}-${git.commit.id.describe} (${project.codename})
                            </Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
