<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~  Copyright (c) 2024, 2025 Contributors to the Eclipse Foundation
~   All rights reserved. This program and the accompanying materials
~   are made available under the terms of the Eclipse Public License v1.0
~   and Apache License v2.0 which accompanies this distribution.
~   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
~   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
~
~   You may elect to redistribute this code under either of these licenses.
~
~   Contributors:
~
~   Ondro Mihalyi
~   Arjan Tijms
~
-->
<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>

    <parent>
        <groupId>org.glassfish.main.persistence</groupId>
        <artifactId>persistence</artifactId>
        <version>9.0.0-M2</version>
    </parent>

    <artifactId>jnosql-integration</artifactId>
    <packaging>glassfish-jar</packaging>

    <name>Eclipse JNoSQL Integration for GlassFish</name>
    <description>
        Integration of JNoSQL, and Jakarta Data repositories for both Jakarta Persistence and NoSQL entities
    </description>

    <dependencies>
        <dependency>
            <groupId>jakarta.cdi</groupId>
            <artifactId>jakarta.cdi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jnosql.mapping</groupId>
            <artifactId>jnosql-jakarta-persistence</artifactId>
            <version>${jnosql.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.jnosql.mapping</groupId>
                    <artifactId>jnosql-jakarta-persistence-scanner</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.jnosql.mapping</groupId>
                    <artifactId>jnosql-mapping-reflection</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jakarta.data</groupId>
            <artifactId>jakarta.data-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.nosql</groupId>
            <artifactId>jakarta.nosql-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.main.common</groupId>
            <artifactId>glassfish-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.main.common</groupId>
            <artifactId>internal-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jpa-container</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.hk2</groupId>
            <artifactId>hk2-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.hk2</groupId>
            <artifactId>hk2-locator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- unpack JARs embedded in the OSGi bundle dependency - they are referenced from system dependencies -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>ee.omnifish</includeGroupIds>
                            <excludeTransitive>true</excludeTransitive>
                            <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Creates the OSGi MANIFEST.MF file -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <_noimportjava>true</_noimportjava>
                        <_runee>JavaSE-17</_runee>

                        <Import-Package>
                            org.eclipse.jnosql.communication,
                            *
                        </Import-Package>
                        <Export-Package>
                            *
                        </Export-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Adds the manifest file created by the org.apache.felix:maven-bundle-plugin -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <copy.modules.to.distribution.skip>false</copy.modules.to.distribution.skip>
            </properties>
        </profile>
    </profiles>
</project>
