<?xml version="1.0" encoding="UTF-8"?>
<!--
 ~ Hibernate Search, full-text search for your domain model
 ~
 ~ License: GNU Lesser General Public License (LGPL), version 2.1 or later
 ~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
  -->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.hibernate.search</groupId>
        <artifactId>hibernate-search-parent-public</artifactId>
        <version>6.2.3.Final</version>
        <relativePath>../../../../build/parents/public</relativePath>
    </parent>
    <artifactId>hibernate-search-parent-public-orm6</artifactId>
    <packaging>pom</packaging>

    <name>Hibernate Search Parent POM for Public Artifacts - ORM6</name>
    <description>Common build configuration for all ORM6 public artifacts</description>

    <properties>
        <surefire.integration>orm6</surefire.integration>

        <!-- JQAssistant does not seem to work correctly on these artifacts for some reason -->
        <jqassistant.skip>true</jqassistant.skip>
        <!-- Forbiddenapis fails when some forbidden methods are not found, and some forbidden methods were removed in ORM 6 -->
        <forbiddenapis.skip>true</forbiddenapis.skip>
        <!-- Prevent these modules from artificially affecting Sonar metrics -->
        <sonar.skip>true</sonar.skip>

        <version.net.bytebuddy>${version.net.bytebuddy.orm6}</version.net.bytebuddy>

        <!-- To be set by child modules -->
        <transform.original.pathFromRoot></transform.original.pathFromRoot>
        <transform.original.path>${rootProject.directory}/${transform.original.pathFromRoot}</transform.original.path>
        <transform.output.root.path>${project.build.directory}/copied-sources</transform.output.root.path>
        <transform.output.main.sources.path>${transform.output.root.path}/main/java</transform.output.main.sources.path>
        <transform.output.main.resources.path>${transform.output.root.path}/main/resources</transform.output.main.resources.path>
        <transform.output.test.sources.path>${transform.output.root.path}/test/java</transform.output.test.sources.path>
        <transform.output.test.resources.path>${transform.output.root.path}/test/resources</transform.output.test.resources.path>
        <transform.patch.path>${project.basedir}/ant-src-changes.patch</transform.patch.path>
        <documentation.config.properties.skip>true</documentation.config.properties.skip>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Solve dependency convergence issues through exclusions for transitive-only dependencies -->
            <dependency>
                <groupId>org.hibernate.search</groupId>
                <artifactId>hibernate-search-mapper-pojo-base</artifactId>
                <version>${project.version}</version>
                <exclusions>
                    <!-- Also imported by Hibernate ORM -->
                    <exclusion>
                        <groupId>org.hibernate.common</groupId>
                        <artifactId>hibernate-commons-annotations</artifactId>
                    </exclusion>
                    <!-- We use Jandex 3 -->
                    <exclusion>
                        <groupId>org.jboss</groupId>
                        <artifactId>jandex</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.hibernate.search</groupId>
                <artifactId>hibernate-search-util-common</artifactId>
                <version>${project.version}</version>
                <exclusions>
                    <!-- We use Jandex 3 -->
                    <exclusion>
                        <groupId>org.jboss</groupId>
                        <artifactId>jandex</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.hibernate.search</groupId>
                <artifactId>hibernate-search-util-internal-test-common</artifactId>
                <version>${project.version}</version>
                <exclusions>
                    <!-- We use Jandex 3 -->
                    <exclusion>
                        <groupId>org.jboss</groupId>
                        <artifactId>jandex</artifactId>
                    </exclusion>
                    <!-- Trust the ORM 6 dependency to bring in the correct version of Jandex and Bytebuddy
                         (which, unfortunately, might be different from the version used in ORM 5.x
                         on which our utils are aligned) -->
                    <exclusion>
                        <groupId>net.bytebuddy</groupId>
                        <artifactId>byte-buddy</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-runtime</artifactId>
                <!-- DO NOT MANAGE the version of this dependency. -->
                <exclusions>
                    <!-- Also imported by jakarta.xml.bind-api -->
                    <exclusion>
                        <groupId>jakarta.activation</groupId>
                        <artifactId>jakarta.activation-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.jberet</groupId>
                <artifactId>jberet-core</artifactId>
                <version>${version.org.jberet.jakarta}</version>
                <exclusions>
                    <!-- These dependencies are marked as "provided" but will never be there at runtime.
                         This confuses maven-enforcer-plugin, so we'll exclude them. -->
                    <exclusion>
                        <groupId>org.jboss.logging</groupId>
                        <artifactId>jboss-logging-processor</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.infinispan</groupId>
                        <artifactId>infinispan-core</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.infinispan</groupId>
                        <artifactId>infinispan-commons</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <id>copy-and-transform-sources</id>
                            <phase>initialize</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <!-- WARNING: if you update this, make sure to update the "internal" and "integrationtest" parent POMs, too -->
                                <target>
                                    <ant dir="${rootProject.directory}/orm6/" antfile="ant-copy-and-transform-sources.xml">
                                        <target name="copy"/>
                                        <target name="transform"/>
                                        <target name="patch"/>
                                    </ant>
                                </target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-sources-copy</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${transform.output.main.sources.path}</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-resources-copy</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${transform.output.main.resources.path}</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-test-sources-copy</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${transform.output.test.sources.path}</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-test-resources-copy</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>add-test-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${transform.output.test.resources.path}</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>ban-jandex-2</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <!-- We use Jandex 3 instead: io.smallrye:jandex, io.smallrye:jandex-maven-plugin -->
                                        <exclude>org.jboss:jandex*</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
