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

    <groupId>io.github.abhiramrathod</groupId>
    <artifactId>mcpTesting</artifactId>
    <version>1.0.35</version>
    <packaging>pom</packaging>

    <name>MCP Testing Framework</name>
    <description>Production-grade Java testing framework for Model Context Protocol (MCP) servers.</description>
    <url>https://github.com/Abhiramrathod/mcp-testing</url>

    <modules>
        <module>mcp-test-interfaces</module>
        <module>mcp-test-core</module>
        <module>mcp-test-transport</module>
        <module>mcp-test-client</module>
        <module>mcp-test-api</module>
        <module>mcp-test-examples</module>
    </modules>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jackson.version>2.15.2</jackson.version>
        <!-- allow deploys; CI workflow should provide credentials and signing -->
        <maven.deploy.skip>false</maven.deploy.skip>
        <!-- When using explicit GPG signing in CI (Portal API flow), skip the maven-gpg-plugin
             to avoid plugin-invoked signing failures in environments where gpg is handled
             by the workflow itself. The CI will set this property as needed. -->
        <gpg.skip>true</gpg.skip>
    </properties>

    <!-- Distribution configured for Sonatype OSSRH (Maven Central). To publish,
         create Sonatype OSSRH credentials and configure CI to supply them as
         secrets (OSSRH_USERNAME and OSSRH_PASSWORD). Snapshots will be published
         to the snapshots repository. -->
    <distributionManagement>
        <repository>
            <id>ossrh</id>
            <name>OSSRH Staging</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <snapshotRepository>
            <id>ossrh</id>
            <name>OSSRH Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.abhiramrathod</groupId>
                <artifactId>mcp-test-interfaces</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.abhiramrathod</groupId>
                <artifactId>mcp-test-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.abhiramrathod</groupId>
                <artifactId>mcp-test-transport</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.abhiramrathod</groupId>
                <artifactId>mcp-test-client</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.abhiramrathod</groupId>
                <artifactId>mcp-test-api</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <licenses>
        <license>
            <name>Apache 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/Abhiramrathod/mcp-testing</url>
        <connection>scm:git:git://github.com/Abhiramrathod/mcp-testing.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/Abhiramrathod/mcp-testing.git</developerConnection>
    </scm>

    <developers>
        <developer>
            <id>abhiramrathod</id>
            <name>Abhiram Rathod</name>
            <email>abhiramrathod2003@gmail.com</email>
            <url>https://github.com/Abhiramrathod</url>
        </developer>
    </developers>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.6.3</version>
                    <configuration>
                        <source>17</source>
                        <show>public</show>
                        <detectJavaApiLink>true</detectJavaApiLink>
                        <doclint>none</doclint>
                        <failOnError>false</failOnError>
                        <quiet>true</quiet>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.6</version>
                    <configuration>
                        <forkCount>1</forkCount>
                        <reuseForks>false</reuseForks>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.16.2</version>
                </plugin>
            </plugins>
        </pluginManagement>
    
        <plugins>
            <!-- Generate sources JAR (required by Maven Central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Generate javadoc JAR (required by Maven Central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.nicoulaj.maven.plugins</groupId>
                <artifactId>checksum-maven-plugin</artifactId>
                <version>1.11</version>
                <executions>
                                    <!-- Removed first checksum execution that used ${project.build.directory} -->
                                    <execution>
                        <id>create-checksums-repo</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>files</goal>
                        </goals>
                        <configuration>
                            <algorithms>
                                <algorithm>MD5</algorithm>
                                <algorithm>SHA-1</algorithm>
                            </algorithms>
                            <fileSets>
                                <fileSet>
                                    <directory>${settings.localRepository}</directory>
                                    <includes>
                                        <include>**/*.jar</include>
                                        <include>**/*.pom</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                        </configuration>
                    </execution>
                    </executions>
            </plugin>

            <!-- Nexus staging plugin to work with Sonatype OSSRH -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.13</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <!-- Nexus staging plugin expects the Nexus base URL (no path) -->
                    <!-- Use primary OSSRH host as fallback while s01 is down -->
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <!-- Central publishing plugin: uploads bundle to central.sonatype.com -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.9.0</version>
                <extensions>true</extensions>
                <configuration>
                    <!-- server id matched in settings.xml / Actions setup-java -->
                    <!-- Use 'ossrh' (Sonatype OSSRH server id) so credentials provided by
                         the CI job are picked up for nexus staging and deploy steps. -->
                    <publishingServerId>ossrh</publishingServerId>
                    <!-- Enable automatic publish after validation -->
                    <autoPublish>true</autoPublish>
                    <!-- Wait until published (blocks until published) -->
                    <waitUntil>published</waitUntil>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
