<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2015 The Gravitee team (http://gravitee.io)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

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

    <parent>
        <groupId>io.gravitee</groupId>
        <artifactId>gravitee-parent</artifactId>
        <version>23.5.0</version>
    </parent>

    <groupId>io.gravitee.ai.gliner4j</groupId>
    <artifactId>gravitee-gliner4j</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <name>Gravitee.io - GLiNER4j</name>
    <description>Java library for GLiNER2 NER model inference via ONNX Runtime</description>

    <modules>
        <module>gliner4j-core</module>
        <module>gliner4j-demo</module>
        <module>gliner4j-benchmark</module>
    </modules>

    <properties>
        <maven.compiler.release>21</maven.compiler.release>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <onnxruntime.version>1.27.0</onnxruntime.version>
        <!-- ONNX Runtime native artifact: "onnxruntime" (CPU + CoreML) by default,
             switched to "onnxruntime_gpu" (CUDA/TensorRT) by the "cuda" profile. -->
        <onnxruntime.artifactId>onnxruntime</onnxruntime.artifactId>
        <djl-tokenizers.version>0.31.0</djl-tokenizers.version>
        <jackson.version>2.17.2</jackson.version>
        <lombok.version>1.18.44</lombok.version>
        <slf4j.version>2.0.16</slf4j.version>
        <junit.version>5.11.3</junit.version>
        <assertj.version>3.26.3</assertj.version>
        <opentelemetry.version>1.43.0</opentelemetry.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.microsoft.onnxruntime</groupId>
                <artifactId>onnxruntime</artifactId>
                <version>${onnxruntime.version}</version>
            </dependency>
            <dependency>
                <groupId>com.microsoft.onnxruntime</groupId>
                <artifactId>onnxruntime_gpu</artifactId>
                <version>${onnxruntime.version}</version>
            </dependency>
            <!-- No official OpenVINO build exists for Java; build + install it locally via
                 scripts/build_ort_openvino.sh, then select it with the "openvino" profile. -->
            <dependency>
                <groupId>com.microsoft.onnxruntime</groupId>
                <artifactId>onnxruntime_openvino</artifactId>
                <version>${onnxruntime.version}</version>
            </dependency>
            <dependency>
                <groupId>ai.djl.huggingface</groupId>
                <artifactId>tokenizers</artifactId>
                <version>${djl-tokenizers.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>
            <dependency>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-bom</artifactId>
                <version>${opentelemetry.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/*.txt</exclude>
                        <exclude>**/*.json</exclude>
                        <exclude>models/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.hubspot.maven.plugins</groupId>
                <artifactId>prettier-maven-plugin</artifactId>
                <configuration>
                    <inputGlobs>
                        <inputGlob>src/main/java/**/*.java</inputGlob>
                        <inputGlob>src/test/java/**/*.java</inputGlob>
                    </inputGlobs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>@{argLine} --add-opens java.base/java.lang=ALL-UNNAMED
                        --add-opens java.base/java.util=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <release>21</release>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </path>
                        </annotationProcessorPaths>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>com.hubspot.maven.plugins</groupId>
                    <artifactId>prettier-maven-plugin</artifactId>
                    <version>${prettier-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <!--
            CUDA / GPU build. Activate with `-Pcuda` to swap the CPU ONNX Runtime native artifact
            for `onnxruntime_gpu` (CUDA + TensorRT execution providers). Requires a CUDA-capable
            host with matching CUDA/cuDNN runtime libraries at run time. Select the provider at run
            time with the demo's 3rd arg (`cuda`) or the benchmark param (`-p executionProvider=cuda`).
        -->
        <profile>
            <id>cuda</id>
            <properties>
                <onnxruntime.artifactId>onnxruntime_gpu</onnxruntime.artifactId>
            </properties>
        </profile>
        <!--
            OpenVINO build. Activate with `-Popenvino` to use the locally-built OpenVINO ONNX Runtime
            (com.microsoft.onnxruntime:onnxruntime_openvino), produced by scripts/build_ort_openvino.sh.
            There is no official OpenVINO artifact for Java, so the jar must be installed locally first.
            At run time the OpenVINO runtime libraries must be on the loader path (setupvars.sh), and the
            provider is selected with the demo's 3rd arg (`openvino`) or `-p executionProvider=openvino`.
        -->
        <profile>
            <id>openvino</id>
            <properties>
                <onnxruntime.artifactId>onnxruntime_openvino</onnxruntime.artifactId>
            </properties>
        </profile>
    </profiles>
</project>
