<?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>dev.jcputney</groupId>
    <artifactId>magika-java</artifactId>
    <version>0.3.0</version>
    <packaging>jar</packaging>

    <name>magika-java</name>
    <description>Clean-room Java binding for Google Magika ONNX file-type detection. Independent community binding — not official, not endorsed by Google.</description>
    <url>https://github.com/jcputney/magika-java</url>
    <inceptionYear>2026</inceptionYear>

    <scm>
        <url>${project.url}</url>
        <connection>scm:git:https://github.com/jcputney/magika-java.git</connection>
        <developerConnection>scm:git:git@github.com:jcputney/magika-java.git</developerConnection>
        <tag>v0.3.0</tag>
    </scm>

    <developers>
        <developer>
            <id>jcputney</id>
            <name>Jonathan Putney</name>
            <email>jonathan@putney.io</email>
            <url>https://github.com/jcputney</url>
        </developer>
    </developers>

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

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.release>17</maven.compiler.release>
        <project.build.outputTimestamp>2026-04-27T16:29:27Z</project.build.outputTimestamp>

        <version.onnxruntime>1.25.0</version.onnxruntime>
        <version.jackson>2.21.2</version.jackson>
        <version.slf4j>2.0.17</version.slf4j>
        <version.junit>6.0.3</version.junit>
        <version.assertj>3.27.7</version.assertj>
        <version.archunit>1.4.2</version.archunit>

        <version.plugin.compiler>3.15.0</version.plugin.compiler>
        <version.plugin.jar>3.5.0</version.plugin.jar>
        <version.plugin.surefire>3.5.5</version.plugin.surefire>
        <version.plugin.failsafe>3.5.5</version.plugin.failsafe>
        <version.plugin.source>3.4.0</version.plugin.source>
        <version.plugin.javadoc>3.12.0</version.plugin.javadoc>
        <version.plugin.spotless>3.4.0</version.plugin.spotless>
        <version.plugin.license>5.0.0</version.plugin.license>
        <version.plugin.invoker>3.10.0</version.plugin.invoker>

        <version.plugin.gpg>3.2.8</version.plugin.gpg>
        <version.plugin.release>3.3.1</version.plugin.release>
        <version.plugin.central-publishing>0.10.0</version.plugin.central-publishing>
        <version.plugin.cyclonedx>2.9.1</version.plugin.cyclonedx>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.microsoft.onnxruntime</groupId>
            <artifactId>onnxruntime</artifactId>
            <version>${version.onnxruntime}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${version.jackson}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${version.slf4j}</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${version.assertj}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit-junit5</artifactId>
            <version>${version.archunit}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${version.slf4j}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${version.plugin.release}</version>
                    <configuration>
                        <arguments>-ntp</arguments>
                        <scmCommentPrefix />
                        <tagNameFormat>v@{project.version}</tagNameFormat>
                        <releaseProfiles>central,sign</releaseProfiles>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${version.plugin.compiler}</version>
                <configuration>
                    <release>17</release>
                    <parameters>true</parameters>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${version.plugin.jar}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.plugin.surefire}</version>
                <configuration>
                    <groups>unit</groups>
                    <excludedGroups>parity,slow</excludedGroups>
                    <systemPropertyVariables>
                        <org.slf4j.simpleLogger.defaultLogLevel>info</org.slf4j.simpleLogger.defaultLogLevel>
                        <org.slf4j.simpleLogger.showDateTime>false</org.slf4j.simpleLogger.showDateTime>
                    </systemPropertyVariables>
                    <useModulePath>false</useModulePath>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${version.plugin.failsafe}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <groups>parity</groups>
                    <includes>
                        <include>**/*IT.java</include>
                        <include>**/MagikaLoggingTest.java</include>
                    </includes>
                    <systemPropertyVariables>
                        <org.slf4j.simpleLogger.defaultLogLevel>info</org.slf4j.simpleLogger.defaultLogLevel>
                        <org.slf4j.simpleLogger.showDateTime>false</org.slf4j.simpleLogger.showDateTime>
                    </systemPropertyVariables>
                    <useModulePath>false</useModulePath>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>${version.plugin.invoker}</version>
                <configuration>
                    <projectsDirectory>src/it</projectsDirectory>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                </configuration>
                <executions>
                    <execution>
                        <id>jpms-consumer-it</id>
                        <goals>
                            <goal>install</goal>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${version.plugin.source}</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.plugin.javadoc}</version>
                <configuration>
                    <additionalOptions>-Xdoclint:-missing</additionalOptions>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${version.plugin.spotless}</version>
                <configuration>
                    <java>
                        <eclipse>
                            <file>${project.basedir}/build-config/java_style.xml</file>
                        </eclipse>
                        <removeUnusedImports />
                        <importOrder />
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${version.plugin.license}</version>
                <configuration>
                    <licenseSets>
                        <licenseSet>
                            <header>${project.basedir}/build-config/license-header.txt</header>
                            <includes>
                                <include>src/main/java/**/*.java</include>
                                <include>src/test/java/**/*.java</include>
                            </includes>
                        </licenseSet>
                    </licenseSets>
                    <properties>
                        <project.inceptionYear>${project.inceptionYear}</project.inceptionYear>
                    </properties>
                </configuration>
                <executions>
                    <execution>
                        <id>check-license-headers</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>verify</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${version.plugin.gpg}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals><goal>sign</goal></goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>central</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${version.plugin.central-publishing}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <!-- v0.3.0 first-publish safety per P-01: operator clicks Publish manually
                                 in Central Portal UI after inspection. NEVER pair autoPublish=false
                                 with waitUntil=published — that deadlocks the workflow for the GH
                                 Actions 6h timeout. Flip both to autoPublish=true + waitUntil=published
                                 in a follow-up commit before v0.3.1. -->
                            <autoPublish>false</autoPublish>
                            <waitUntil>validated</waitUntil>
                            <deploymentName>${project.artifactId}:${project.version}</deploymentName>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.cyclonedx</groupId>
                        <artifactId>cyclonedx-maven-plugin</artifactId>
                        <version>${version.plugin.cyclonedx}</version>
                        <executions>
                            <execution>
                                <id>build-sbom</id>
                                <phase>package</phase>
                                <goals><goal>makeBom</goal></goals>
                            </execution>
                        </executions>
                        <configuration>
                            <projectType>library</projectType>
                            <schemaVersion>1.6</schemaVersion>
                            <outputFormat>all</outputFormat>
                            <!-- Phase 5 peer-review fix: by default the plugin skips when not deploying,
                                 which means a plain 'mvn package' inside the central profile produces no
                                 SBOM. release:perform runs deploy, but the SBOM attaches to the deploy
                                 step rather than the package step; setting skipNotDeployed=false ensures
                                 the SBOM is generated in package phase regardless and is therefore
                                 available to attach to the bundle uploaded to Central. -->
                            <skipNotDeployed>false</skipNotDeployed>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>github</id>
            <distributionManagement>
                <repository>
                    <id>github</id>
                    <name>GitHub Packages</name>
                    <url>https://maven.pkg.github.com/jcputney/magika-java</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>
</project>
