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

    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.

    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.helidon.integrations.cdi</groupId>
        <artifactId>helidon-integrations-cdi-project</artifactId>
        <version>1.4.2</version>
    </parent>
    <artifactId>helidon-integrations-cdi-jpa</artifactId>
    <name>Helidon CDI Integrations JPA</name>

    <properties>
      <doclint>-syntax</doclint>
      <spotbugs.exclude>etc/spotbugs/exclude.xml</spotbugs.exclude>
    </properties>

    <dependencies>
        <!-- Test-scoped dependencies. -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld.se</groupId>
            <artifactId>weld-se-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>helidon-integrations-cdi-jta-weld</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>helidon-integrations-cdi-datasource-hikaricp</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>helidon-integrations-cdi-eclipselink</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.helidon.microprofile.config</groupId>
            <artifactId>helidon-microprofile-config-cdi</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Runtime-scoped dependencies. -->
        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jandex</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- Provided-scoped dependencies. -->
        <dependency>
            <groupId>jakarta.persistence</groupId>
            <artifactId>jakarta.persistence-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>javax.transaction-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Compile-scoped dependencies. -->
        <dependency>
            <groupId>io.helidon.integrations.cdi</groupId>
            <artifactId>helidon-integrations-cdi-delegates</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>io.helidon.integrations.cdi</groupId>
            <artifactId>helidon-integrations-cdi-reference-counted-context</artifactId>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <sourceFileExcludes>
                            <!--
                                The eclipselink-maven-plugin's
                                modelgen goal (see below) irrevocably
                                adds its generatedSourcesDirectory to
                                the source roots processed by the
                                maven-javadoc-plugin.  We need to
                                exclude these static metamodel sources
                                because in our case they reference
                                unit-test-only files.  Note that these
                                source roots are added to the javadoc
                                *report*, not just its "generate test
                                javadocs" goal, and even though the
                                sources from which they are generated
                                are only found under src/test/java.
                            -->
                            <sourceFileExclude>**/*_.java</sourceFileExclude>
                        </sourceFileExcludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.ethlo.persistence.tools</groupId>
                <artifactId>eclipselink-maven-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-api</artifactId>
                        <version>${version.lib.junit}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>weave</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>weave</goal>
                        </goals>
                        <configuration>
                            <persistenceInfoLocation>${project.build.testOutputDirectory}</persistenceInfoLocation>
                            <source>${project.build.testOutputDirectory}</source>
                            <target>${project.build.testOutputDirectory}</target>
                        </configuration>
                    </execution>
                    <execution>
                        <id>modelgen</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>modelgen</goal>
                        </goals>
                        <configuration>
                            <source>${project.build.testSourceDirectory}</source>
                            <generatedSourcesDirectory>${project.build.directory}/generated-test-sources/apt</generatedSourcesDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <executions>
                    <execution>
                        <id>Generate persistence.xml Java objects</id>
                        <goals>
                          <goal>generate</goal>
                        </goals>
                        <configuration>
                            <generatePackage>io.helidon.integrations.cdi.jpa.jaxb</generatePackage>
                            <markGenerated>true</markGenerated>
                            <schemas>
                                <schema>
                                    <dependencyResource>
                                        <groupId>jakarta.persistence</groupId>
                                        <artifactId>jakarta.persistence-api</artifactId>
                                        <resource>javax/persistence/persistence_2_2.xsd</resource>
                                    </dependencyResource>
                                </schema>
                            </schemas>
                            <strict>false</strict>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jboss.jandex</groupId>
                <artifactId>jandex-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>make-index</id>
                        <goals>
                            <goal>jandex</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.config.file>${project.basedir}/src/test/logging.properties</java.util.logging.config.file>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>sources</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>resource-bundle</id>
                                <goals>
                                    <goal>resource-bundle</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>xmlbind</id>
            <activation>
                <jdk>[9,)</jdk>
                <activeByDefault>false</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>javax.xml.bind</groupId>
                    <artifactId>jaxb-api</artifactId>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>javax.activation</groupId>
                    <artifactId>javax.activation-api</artifactId>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-core</artifactId>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
