<?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.ai.gliner4j</groupId>
        <artifactId>gravitee-gliner4j</artifactId>
        <version>1.1.1</version>
    </parent>

    <artifactId>gliner4j-llamacpp</artifactId>
    <packaging>jar</packaging>

    <name>GLiNER4j :: llama.cpp backbone</name>
    <description>GLiClass decoder-kv (Qwen3) family: causal backbone on llama.cpp via llamaj.cpp, scorer on ONNX Runtime</description>

    <properties>
        <!-- llamaj.cpp is a Java FFM binding: Java 25 for this module only; gliner4j-core stays on 21 -->
        <maven.compiler.release>25</maven.compiler.release>
        <!-- JaCoCo 0.8.12 cannot instrument Java 25 class files (major 69). -->
        <jacoco.skip>true</jacoco.skip>
        <llamaj.cpp.version>2.8.0</llamaj.cpp.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.gravitee.ai.gliner4j</groupId>
            <artifactId>gliner4j-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gravitee.llama.cpp</groupId>
            <artifactId>llamaj.cpp</artifactId>
            <version>${llamaj.cpp.version}</version>
        </dependency>
        <!-- Like core: provided, so the consuming module picks the runtime artifact (onnxruntime /
             onnxruntime_gpu / onnxruntime_openvino) under its own profile. A compile-scoped
             dependency here resolves to the CPU artifact in this module's installed pom and would
             put both natives on a consumer's classpath — the CPU one wins and CUDA silently falls
             back ("This binary was not compiled with CUDA support"). -->
        <dependency>
            <groupId>com.microsoft.onnxruntime</groupId>
            <artifactId>${onnxruntime.artifactId}</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <!-- Bundled verbatim next to pom.xml (not under src/main/resources) so it's visible
                 in the module root too, but still lands at licenses/ in the jar root. -->
            <resource>
                <directory>${project.basedir}/licenses</directory>
                <targetPath>licenses</targetPath>
            </resource>
        </resources>
        <plugins>
            <!-- The root pom's plugin-level <excludes> is a no-op in license-maven-plugin 4.6
                 (deprecated legacyConfigExcludes, superseded by gravitee-parent's licenseSets);
                 override with the same licenseSet here, plus licenses/**, so the verbatim
                 third-party license texts below aren't rejected for missing an Apache header. -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <licenseSets>
                        <licenseSet>
                            <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                            <excludes>
                                <exclude>LICENSE.txt</exclude>
                                <exclude>NOTICE.txt</exclude>
                                <exclude>**/README</exclude>
                                <exclude>src/main/packaging/**</exclude>
                                <exclude>src/test/resources/**</exclude>
                                <exclude>src/main/resources/**</exclude>
                                <exclude>src/main/webapp/**</exclude>
                                <exclude>node_modules/**</exclude>
                                <exclude>dist/**</exclude>
                                <exclude>.tmp/**</exclude>
                                <exclude>.*</exclude>
                                <exclude>.*/**</exclude>
                                <exclude>**/*.adoc</exclude>
                                <exclude>licenses/**</exclude>
                            </excludes>
                        </licenseSet>
                    </licenseSets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>25</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>--enable-native-access=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED
                        --add-opens java.base/java.util=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <mainClass>io.gravitee.lab.gliner4j.llamacpp.RouterDemo</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
