<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.googlecode.blaisemath</groupId>
    <artifactId>promptex</artifactId>
    <version>0.16.0</version>
    <packaging>pom</packaging>

    <name>${project.artifactId}-${project.version}</name>
    <description>PromptEx: Execution/service layer for AI workflows, RAG pipelines, and MCP integration.</description>
    <url>https://github.com/aplpolaris/promptfx</url>
    <inceptionYear>2023</inceptionYear>

    <modules>
        <!-- AI processing and utilities -->
        <module>promptex-pips</module>
        <module>promptex-docs</module>
        <module>promptex-mcp</module>
    </modules>

    <!-- configuration of the default license to use -->
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <organization>
        <name>Johns Hopkins University Applied Physics Laboratory</name>
    </organization>

    <developers>
        <developer>
            <name>Elisha Peterson</name>
            <email>triathematician+blaise@gmail.com</email>
            <url>https://github.com/triathematician</url>
            <organization>JHU-APL</organization>
            <organizationUrl>http://www.jhuapl.edu</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/aplpolaris/promptfx</url>
        <connection>scm:git:git://github.com/aplpolaris/promptfx.git</connection>
        <developerConnection>scm:git:git@github.com:aplpolaris/promptfx.git</developerConnection>
      <tag>promptex-0.16.0</tag>
  </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/aplpolaris/promptfx/issues</url>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <license.organizationName>Johns Hopkins University Applied Physics Laboratory</license.organizationName>
        <license.licenseName>apache_v2</license.licenseName>

        <guava.version>33.5.0-jre</guava.version>
        <jackson.version>2.21.0</jackson.version>
        <jackson-annotations.version>2.21</jackson-annotations.version>
        <jsoup.version>1.22.1</jsoup.version>
        <junit.version>6.0.3</junit.version>
        <kotlin.version>2.3.10</kotlin.version>
        <kotlinx-coroutines-core.version>1.10.2</kotlinx-coroutines-core.version> <!-- match version in openai-client -->
        <kotlinx-serialization.version>1.10.0</kotlinx-serialization.version>
        <kotlin-dokka.version>2.1.0</kotlin-dokka.version>
        <ktor.version>3.4.0</ktor.version> <!-- match version in openai-client -->
        <okhttp.version>5.3.2</okhttp.version>
        <pdfbox.version>3.0.6</pdfbox.version>
        <poi.version>5.5.1</poi.version>
        <slf4j.version>2.0.17</slf4j.version> <!-- match version in io.ktor -->
        <log4j.version>2.25.3</log4j.version> <!-- match version in poi -->
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version> <!-- or latest 2.x -->
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>

        <plugins>
            <!-- maven and java required versions -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.6.2</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.6.3</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>11</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- set jvm target version java 17 -->
            <!-- kotlin-maven-plugin should occur before maven-compiler-plugin to ensure kotlin is compiled first -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <configuration>
                    <jvmTarget>17</jvmTarget>
                    <compilerPlugins>
                        <plugin>kotlinx-serialization</plugin>
                    </compilerPlugins>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-serialization</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- set java 17 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>

            <!-- update surefire plugin for junit 5 -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.4</version>
                <configuration>
                    <!-- TODO - set up profiles so we can run different test sets from command line -->
                    <!--                    <excludedGroups>gemini</excludedGroups>-->
                    <excludedGroups>gemini | openai</excludedGroups>
                    <useModulePath>false</useModulePath>
                </configuration>
            </plugin>

            <!-- Automatically update file headers, and add license file to distribution -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>1.20</version>
                <configuration>
                    <roots>
                        <root>src/main/kotlin</root>
                        <root>src/test/kotlin</root>
                    </roots>
                    <canUpdateCopyright>true</canUpdateCopyright>
                    <canUpdateDescription>false</canUpdateDescription>
                    <projectName>tri.promptfx:promptex</projectName>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>update-project-license</goal>
                            <goal>update-file-header</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- generate SBOM -->
            <plugin>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-maven-plugin</artifactId>
                <version>2.8.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>makeAggregateBom</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Version specified for compatibility with maven-project-info-reports-plugin 3.0.0-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.12.1</version>
            </plugin>

            <!-- ensure release plugin skips javadocs step since that's done with dokka -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <arguments>-Dmaven.javadoc.skip=true</arguments>
                    <releaseProfiles>release</releaseProfiles>
                </configuration>
            </plugin>

            <!-- build javadocs with dokka -->
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${kotlin-dokka.version}</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <reportUndocumented>false</reportUndocumented>
                    <skipEmptyPackages>true</skipEmptyPackages>
                    <jdkVersion>17</jdkVersion>
                    <platform>JVM</platform>
                    <noStdlibLink>true</noStdlibLink>
                    <noJdkLink>true</noJdkLink>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.17.1</version>
                <configuration>
                    <allowSnapshots>false</allowSnapshots>
                    <ignoredVersions>.*-(alpha|beta|Beta|rc|RC|M|ea).*</ignoredVersions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <!-- check for vulnerabilities, with `mvn verify` or `mvn site` -->
            <plugin>
                <groupId>org.owasp</groupId>
                <artifactId>dependency-check-maven</artifactId>
                <version>9.1.0</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>aggregate</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <!-- this is for building sources & javadocs, signing, & deploying to staging repo -->
            <id>release</id>
            <build>
                <plugins>
                    <!-- build sources -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.4.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- sign the artifacts with gpg (requires command-line utility) -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- deploy to maven central -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.10.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>