<?xml version="1.0" encoding="UTF-8"?>
<!--
SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
--><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.nvidia.cuvs</groupId>
    <artifactId>cuvs-java</artifactId>
    <!-- NOTE: The version automatically gets updated when ci/release/update-version.sh is invoked. -->
    <!--CUVS_JAVA#VERSION_UPDATE_MARKER_START--><version>26.08.0</version><!--CUVS_JAVA#VERSION_UPDATE_MARKER_END-->
    <name>cuvs-java</name>
    <description>
        This project provides Java bindings for cuVS, enabling approximate nearest neighbors search and clustering
        on the GPU. As this is experimental, some APIs may change.
    </description>
    <url>https://rapids.ai</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:https://github.com/rapidsai/cuvs.git</connection>
        <developerConnection>scm:git:git@github.com:rapidsai/cuvs.git</developerConnection>
        <tag>HEAD</tag>
        <url>https://github.com/rapidsai/cuvs</url>
    </scm>
    <developers>
        <developer>
            <id>rapidsai</id>
            <name>rapidsai</name>
            <email>cuvs@rapids.ai</email>
            <roles>
                <role>Maintainer</role>
                <role>Committer</role>
            </roles>
        </developer>
    </developers>
    <packaging>jar</packaging>

    <properties>
        <maven.compiler.target>22</maven.compiler.target>
        <maven.compiler.source>22</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <native.build.path>${project.build.directory}/../../../cpp/build</native.build.path>
    </properties>

    

    

    <dependencies>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.36</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.36</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.carrotsearch.randomizedtesting</groupId>
            <artifactId>randomizedtesting-runner</artifactId>
            <version>2.8.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <release>21</release>
                            <compileSourceRoots>
                                <compileSourceRoot>${project.basedir}/src/main/java</compileSourceRoot>
                            </compileSourceRoots>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile-java-22</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <release>22</release>
                            <compileSourceRoots>
                                <compileSourceRoot>${project.basedir}/src/main/java22</compileSourceRoot>
                            </compileSourceRoots>
                            <multiReleaseOutput>true</multiReleaseOutput>
                            <excludes>
                                <exclude>module-info.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.5.2</version>
                <configuration>
                    <forkCount>1</forkCount>
                    <argLine>--enable-native-access=com.nvidia.cuvs</argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.4.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Multi-Release>true</Multi-Release>
                            <addClasspath>true</addClasspath>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>test-jars</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludeResources>true</excludeResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.11.2</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <excludePackageNames>com.nvidia.cuvs.examples,com.nvidia.cuvs.panama</excludePackageNames>
                            <doclint>all,-missing</doclint>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.44.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
                <configuration>
                    <java>
                        <includes>
                            <include>src/**/*.java</include>
                        </includes>
                        <excludes>
                            <exclude>src/**/panama/*.java</exclude>
                        </excludes>
                        <googleJavaFormat>
                            <version>1.27.0</version>
                            <style>GOOGLE</style>
                            <reflowLongStrings>true</reflowLongStrings>
                            <formatJavadoc>false</formatJavadoc>
                        </googleJavaFormat>
                        <licenseHeader>
                            <file>${project.basedir}/../license-header.txt</file>
                        </licenseHeader>
                    </java>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>x86_64-cuda12</id>
            <activation>
                <property>
                    <name>cuda.version</name>
                    <value>12</value>
                </property>
            </activation>
            <properties>
                <native.classifier>x86_64-cuda12</native.classifier>
                <native.lib.path>${native.build.path}/cuda12</native.lib.path>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>copy-native-libs</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <overwrite>true</overwrite>
                                    <outputDirectory>${project.build.directory}/native-libs/${os.arch}/${os.name}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${native.lib.path}</directory>
                                            <includes>
                                                <include>libcuvs.so</include>
                                                <include>libcuvs_c.so</include>
                                            </includes>
                                        </resource>
                                        <resource>
                                            <directory>${native.lib.path}/_deps/rmm-build</directory>
                                            <includes>
                                                <include>librmm.so</include>
                                            </includes>
                                        </resource>
                                        <resource>
                                            <directory>${native.lib.path}/_deps/rapids_logger-build</directory>
                                            <includes>
                                                <include>librapids_logger.so</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.4.2</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/native-with-deps.xml</descriptor>
                            </descriptors>
                            <archive>
                                <manifestEntries>
                                    <Multi-Release>true</Multi-Release>
                                    <addClasspath>true</addClasspath>
                                    <Embedded-Libraries-Cuda-Version>12</Embedded-Libraries-Cuda-Version>
                                </manifestEntries>
                            </archive>
                        </configuration>
                        <executions>
                            <execution>
                                <id>assemble-native</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>x86_64-cuda13</id>
            <activation>
                <property>
                    <name>cuda.version</name>
                    <value>13</value>
                </property>
            </activation>
            <properties>
                <native.classifier>x86_64-cuda13</native.classifier>
                <native.lib.path>${native.build.path}/cuda13</native.lib.path>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>copy-native-libs</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <overwrite>true</overwrite>
                                    <outputDirectory>${project.build.directory}/native-libs/${os.arch}/${os.name}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${native.lib.path}</directory>
                                            <includes>
                                                <include>libcuvs.so</include>
                                                <include>libcuvs_c.so</include>
                                            </includes>
                                        </resource>
                                        <resource>
                                            <directory>${native.lib.path}/_deps/rmm-build</directory>
                                            <includes>
                                                <include>librmm.so</include>
                                            </includes>
                                        </resource>
                                        <resource>
                                            <directory>${native.lib.path}/_deps/rapids_logger-build</directory>
                                            <includes>
                                                <include>librapids_logger.so</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.4.2</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/native-with-deps.xml</descriptor>
                            </descriptors>
                            <archive>
                                <manifestEntries>
                                    <Multi-Release>true</Multi-Release>
                                    <addClasspath>true</addClasspath>
                                    <Embedded-Libraries-Cuda-Version>13</Embedded-Libraries-Cuda-Version>
                                </manifestEntries>
                            </archive>
                        </configuration>
                        <executions>
                            <execution>
                                <id>assemble-native</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
