<?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>
    <name>json-io-parent</name>
    <groupId>com.cedarsoftware</groupId>
    <artifactId>json-io-parent</artifactId>
    <packaging>pom</packaging>
    <version>4.100.0</version>
    <description>Parent POM for json-io modules</description>
    <url>https://github.com/jdereg/json-io</url>

    <modules>
        <module>json-io</module>
        <module>json-io-spring</module>
        <module>json-io-spring-ai</module>
    </modules>

    <developers>
        <developer>
            <id>jdereg</id>
            <name>John DeRegnaucourt</name>
            <email>jdereg@gmail.com</email>
        </developer>
        <developer>
            <id>kpartlow</id>
            <name>Kenny Partlow</name>
            <email>kpartlow@gmail.com</email>
        </developer>
    </developers>

    <properties>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss.SSSZ</maven.build.timestamp.format>
        <!-- remove source encoding warnings from maven output -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.java-util>4.100.0</version.java-util>
        <!-- testing only -->
        <version.junit-jupiter-api>5.14.3</version.junit-jupiter-api>
        <version.junit-jupiter-params>5.14.3</version.junit-jupiter-params>
        <version.mockito-junit-jupiter>4.11.0</version.mockito-junit-jupiter>   <!-- can't update until they have JDK support -->
        <version.assertj-core>3.27.7</version.assertj-core>
        <version.gson>2.13.2</version.gson>
        <version.jackson-databind>2.21.2</version.jackson-databind>
        <version.jtokkit>1.1.0</version.jtokkit>

        <!-- Build maven-***-plugins-->
        <version.maven-jar-plugin>3.5.0</version.maven-jar-plugin>
        <version.maven-gpg-plugin>3.2.8</version.maven-gpg-plugin>
        <version.maven-compiler-plugin>3.15.0</version.maven-compiler-plugin>
        <version.maven-javadoc-plugin>3.12.0</version.maven-javadoc-plugin>
        <version.maven-surefire-plugin>3.5.5</version.maven-surefire-plugin>
        <version.maven-source-plugin>3.4.0</version.maven-source-plugin>
        <version.maven-scr-plugin>1.26.4</version.maven-scr-plugin>
        <version.maven-bundle-plugin>6.0.2</version.maven-bundle-plugin>
        <version.moditect-maven-plugin>1.3.0.Final</version.moditect-maven-plugin>

        <!-- Core plugins explicitly pinned to avoid Maven 4 warnings -->
        <version.maven-resources-plugin>3.4.0</version.maven-resources-plugin>
        <version.maven-install-plugin>3.1.4</version.maven-install-plugin>
        <version.maven-deploy-plugin>3.1.4</version.maven-deploy-plugin>

        <!-- release to Maven Central via Sonatype Nexus -->
        <version.central-publishing-maven-plugin>0.10.0</version.central-publishing-maven-plugin>

    </properties>

    <profiles>

        <!-- JDK 9 and newer -->
        <profile>
            <id>jdk9-and-above</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>

            <!-- only the flags that modern javac needs -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${version.maven-compiler-plugin}</version>
                        <configuration>
                            <release>8</release>
                            <testRelease>8</testRelease>
                            <encoding>${project.build.sourceEncoding}</encoding>
                            <parameters>true</parameters>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- JDK 8 -->
        <profile>
            <id>jdk8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>

            <!-- classic - source / target for the legacy tool-chain -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>${version.maven-compiler-plugin}</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                            <encoding>${project.build.sourceEncoding}</encoding>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${version.maven-gpg-plugin}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphrase>${gpg.passphrase}</passphrase>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/jdereg/json-io</url>
        <connection>scm:git:git://github.com/jdereg/json-io.git</connection>
        <developerConnection>scm:git:git@github.com:jdereg/json-io.git</developerConnection>
    </scm>

    <distributionManagement>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.cedarsoftware</groupId>
                <artifactId>java-util</artifactId>
                <version>${version.java-util}</version>
            </dependency>

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${version.junit-jupiter-api}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${version.junit-jupiter-api}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${version.junit-jupiter-params}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>${version.mockito-junit-jupiter}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${version.assertj-core}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${version.gson}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${version.jackson-databind}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.knuddels</groupId>
                <artifactId>jtokkit</artifactId>
                <version>${version.jtokkit}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${version.maven-resources-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${version.maven-install-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${version.maven-deploy-plugin}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.maven-jar-plugin}</version>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Implementation-Title>${project.name}</Implementation-Title>
                                <Implementation-Version>${project.version}</Implementation-Version>
                                <Implementation-Vendor-Id>com.cedarsoftware</Implementation-Vendor-Id>
                                <Implementation-URL>https://github.com/jdereg/json-io</Implementation-URL>
                                <Built-By>${user.name}</Built-By>
                                <Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
                                <Build-Jdk>${java.version} (${java.vendor} ${java.vm.version})</Build-Jdk>
                                <Build-OS>${os.name} ${os.arch} ${os.version}</Build-OS>
                            </manifestEntries>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${version.maven-source-plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.maven-javadoc-plugin}</version>
                    <configuration>
                        <additionalOptions>-Xdoclint:none</additionalOptions>
                        <additionalJOption>-Xdoclint:none</additionalJOption>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${version.central-publishing-maven-plugin}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.maven-surefire-plugin}</version>
                    <configuration>
                        <useModulePath>false</useModulePath>
                        <useSystemClassLoader>false</useSystemClassLoader>
                        <argLine>
                            -Duser.timezone=America/New_York
                            -Duser.language=en
                            -Duser.region=US
                            -Duser.country=US
                            -Xmx1024m
                        </argLine>
                        <forkCount>1</forkCount>
                        <reuseForks>true</reuseForks>
                        <properties>
                            <property>
                                <name>junit.jupiter.extensions.autodetection.enabled</name>
                                <value>true</value>
                            </property>
                        </properties>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
