<?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>java-util</name>
    <groupId>com.cedarsoftware</groupId>
    <artifactId>java-util</artifactId>
    <packaging>bundle</packaging>
    <version>4.80.0</version>
    <description>Java Utilities</description>
    <url>https://github.com/jdereg/java-util</url>

    <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>

        <!-- testing only -->
        <version.junit-jupiter-api>5.13.4</version.junit-jupiter-api>
        <version.junit-jupiter-params>5.13.4</version.junit-jupiter-params>
        <version.mockito-junit-jupiter>4.11.0</version.mockito-junit-jupiter>
        <version.assertj-core>3.27.4</version.assertj-core>
        <version.json-io>4.72.0</version.json-io>
        <version.agrona>1.22.0</version.agrona> <!-- do not increase past 1.22.0 until abandoning JDK 8 support, class file format 52 -->
        <version.commons-collections4>4.5.0</version.commons-collections4>
        <version.guava>33.5.0-jre</version.guava>

        <!-- Build maven-***-plugins -->
        <version.maven-jar-plugin>3.4.2</version.maven-jar-plugin>
        <version.maven-gpg-plugin>3.2.8</version.maven-gpg-plugin>
        <version.maven-compiler-plugin>3.14.1</version.maven-compiler-plugin>
        <version.maven-javadoc-plugin>3.12.0</version.maven-javadoc-plugin>
        <version.maven-surefire-plugin>3.5.4</version.maven-surefire-plugin>
        <version.maven-source-plugin>3.3.1</version.maven-source-plugin>
        <version.maven-scr-plugin>1.26.4</version.maven-scr-plugin>
        <version.maven-bundle-plugin>6.0.0</version.maven-bundle-plugin>
        <version.maven-resources-plugin>3.3.1</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>
        <version.moditect-maven-plugin>1.3.0.Final</version.moditect-maven-plugin>

        <!-- release to Maven Central via Sonatype Nexus -->
        <version.central-publishing-maven-plugin>0.9.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/java-util</url>
        <connection>scm:git:git://github.com/jdereg/java-util.git</connection>
        <developerConnection>scm:git:git@github.com:jdereg/java-util.git</developerConnection>
    </scm>

    <distributionManagement>
    </distributionManagement>

    <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>
            </plugins>
        </pluginManagement>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${version.maven-jar-plugin}</version> <!-- Use the latest version available -->
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Title>java-util</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Implementation-Vendor-Id>com.cedarsoftware</Implementation-Vendor-Id>
                            <Implementation-URL>https://github.com/jdereg/java-util</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.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
                <version>${version.maven-scr-plugin}</version>
            </plugin>

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${version.maven-bundle-plugin}</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Export-Package>
                            com.cedarsoftware.util,
                            com.cedarsoftware.util.cache,
                            com.cedarsoftware.util.convert,
                            com.cedarsoftware.util.geom
                        </Export-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <goals>
                            <goal>
                                manifest
                            </goal>
                        </goals>
                    </execution>
                </executions>
            </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>
                    <!--
                    <autoPublish>true</autoPublish>
                    <waitUntil>published</waitUntil>
                    -->
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.maven-surefire-plugin}</version>
                <configuration>
                    <argLine>
                        -Duser.timezone=America/New_York
                        -Duser.language=en
                        -Duser.region=US
                        -Duser.country=US
                        -Xmx1500m
                    </argLine>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <version>${version.moditect-maven-plugin}</version>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <jvmVersion>base</jvmVersion>
                            <module>
                                <moduleInfoSource>
                                    module com.cedarsoftware.util {
                                    requires java.sql;
                                    requires static java.compiler;
                                    requires static java.xml;
                                    exports com.cedarsoftware.util;
                                    exports com.cedarsoftware.util.cache;
                                    exports com.cedarsoftware.util.convert;
                                    exports com.cedarsoftware.util.geom;
                                    }
                                </moduleInfoSource>
                            </module>
                            <overwriteExistingFiles>true</overwriteExistingFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <dependencies>
        <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.cedarsoftware</groupId>
            <artifactId>json-io</artifactId>
            <version>${version.json-io}</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.agrona</groupId>
            <artifactId>agrona</artifactId>
            <version>${version.agrona}</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>${version.commons-collections4}</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${version.guava}</version>
            <scope>test</scope>
        </dependency>

        <!-- pom.xml snippets -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.20.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
            <version>2.20.1</version>
            <scope>test</scope>
        </dependency>
        
    </dependencies>
</project>

