<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2014 - 2021 Blazebit.

  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>com.blazebit</groupId>
        <artifactId>blaze-persistence-examples</artifactId>
        <version>1.6.3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    
    <artifactId>blaze-persistence-examples-deltaspike-data-rest</artifactId>
    <packaging>war</packaging>

    <name>Blazebit Persistence Examples DeltaSpike Data REST</name>

    <properties>
        <module.name>com.blazebit.persistence.examples.deltaspike.data.rest</module.name>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <version.hibernate>5.0.12.Final</version.hibernate>
        <!-- For Hibernate 5.2 use "5.2" -->
        <version.integration-hibernate>5</version.integration-hibernate>
        <version.eclipselink>2.6.4</version.eclipselink>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.deltaspike.distribution</groupId>
                <artifactId>distributions-bom</artifactId>
                <version>${version.deltaspike-1.9}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-8.0</artifactId>
            <version>1.0.4.Final</version>
            <type>pom</type>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.taglibs</groupId>
                    <artifactId>taglibs-standard-spec</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.taglibs</groupId>
                    <artifactId>taglibs-standard-impl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.8.11.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- Core dependencies -->
        <dependency>
            <groupId>com.blazebit</groupId>
            <artifactId>blaze-persistence-core-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.blazebit</groupId>
            <artifactId>blaze-persistence-core-impl</artifactId>
        </dependency>

        <!-- Entity View dependencies -->
        <dependency>
            <groupId>com.blazebit</groupId>
            <artifactId>blaze-persistence-entity-view-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.blazebit</groupId>
            <artifactId>blaze-persistence-entity-view-impl</artifactId>
        </dependency>

        <!-- DeltaSpike and CDI integration dependencies -->
        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-data-module-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.deltaspike.modules</groupId>
            <artifactId>deltaspike-data-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-impl</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.blazebit</groupId>
            <artifactId>blaze-persistence-integration-entity-view-cdi</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>blaze-persistence-integration-deltaspike-data-api</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>blaze-persistence-integration-deltaspike-data-impl-1.8</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>blaze-persistence-integration-deltaspike-data-rest-api</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>blaze-persistence-integration-deltaspike-data-rest-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>blaze-persistence-integration-jaxrs</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.apache.deltaspike.cdictrl</groupId>
            <artifactId>deltaspike-cdictrl-weld</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>weld-api</artifactId>
                    <groupId>org.jboss.weld</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jboss-logging</artifactId>
                    <groupId>org.jboss.logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld.se</groupId>
            <artifactId>weld-se-core</artifactId>
            <version>${version.weld}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss</groupId>
                    <artifactId>jandex</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Since we are including a module-info.class file, we need at least 2.0.4.Final -->
        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jandex</artifactId>
            <version>${version.jandex}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Preparation for Java 9+, include a dependency on the JAXB APIs -->
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>${version.jaxb-api}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>${version.jaxb}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>${version.annotation}</version>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <!-- Skip JAR creation for WAR project -->
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <phase>NONE</phase>
                    </execution>
                    <execution>
                        <id>modular-jar</id>
                        <phase>NONE</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>wildfly</id>
            <activation>
                <property>
                    <name>!skipWildflyProfile</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.blazebit</groupId>
                    <artifactId>blaze-persistence-integration-hibernate-${version.integration-hibernate}</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <version>${version.hibernate}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-jackson2-provider</artifactId>
                    <version>3.0.8.Final</version>
                    <scope>provided</scope>
                </dependency>

                <!-- IntelliJ apparently needs the annotation processor here -->
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-jpamodelgen</artifactId>
                    <version>${version.hibernate}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.bsc.maven</groupId>
                        <artifactId>maven-processor-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>process</id>
                                <goals>
                                    <goal>process</goal>
                                </goals>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <!-- source output directory -->
                                    <outputDirectory>${project.build.directory}/metamodel</outputDirectory>
                                    <processors>
                                        <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
                                    </processors>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <!-- Metamodel -->
                            <dependency>
                                <groupId>org.hibernate</groupId>
                                <artifactId>hibernate-jpamodelgen</artifactId>
                                <version>${version.hibernate}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source-metamodel</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/metamodel</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>glassfish</id>
            <dependencies>
                <dependency>
                    <groupId>com.blazebit</groupId>
                    <artifactId>blaze-persistence-integration-eclipselink</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>javax.persistence</artifactId>
                    <version>2.1.1</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>eclipselink</artifactId>
                    <version>${version.eclipselink}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.jersey.media</groupId>
                    <artifactId>jersey-media-json-jackson</artifactId>
                    <version>2.23.1</version>
                </dependency>

                <!-- IntelliJ apparently needs the annotation processor here -->
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
                    <version>${version.eclipselink}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/generated-sources/metamodel</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.bsc.maven</groupId>
                        <artifactId>maven-processor-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>process</id>
                                <goals>
                                    <goal>process</goal>
                                </goals>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <!-- source output directory -->
                                    <outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
                                    <processors>
                                        <processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
                                    </processors>
                                    <optionMap>
                                        <eclipselink.persistencexml>${basedir}/src/main/resources/META-INF/persistence.xml</eclipselink.persistencexml>
                                    </optionMap>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <!-- Metamodel -->
                            <dependency>
                                <groupId>org.eclipse.persistence</groupId>
                                <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
                                <version>${version.eclipselink}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>hibernate-apt</id>
            <dependencies>
                <dependency>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>blaze-persistence-entity-view-processor</artifactId>
                    <version>${project.version}</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.blazebit</groupId>
                    <artifactId>blaze-persistence-integration-hibernate-${version.integration-hibernate}</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <version>${version.hibernate}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.resteasy</groupId>
                    <artifactId>resteasy-jackson2-provider</artifactId>
                    <version>3.0.8.Final</version>
                    <scope>provided</scope>
                </dependency>

                <!-- IntelliJ apparently needs the annotation processor here -->
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-jpamodelgen</artifactId>
                    <version>${version.hibernate}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.bsc.maven</groupId>
                        <artifactId>maven-processor-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>process</id>
                                <goals>
                                    <goal>process</goal>
                                </goals>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <!-- source output directory -->
                                    <outputDirectory>${project.build.directory}/metamodel</outputDirectory>
                                    <processors>
                                        <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
                                        <processor>com.blazebit.persistence.view.processor.EntityViewAnnotationProcessor</processor>
                                    </processors>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <!-- Metamodel -->
                            <dependency>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>blaze-persistence-entity-view-processor</artifactId>
                                <version>${project.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.hibernate</groupId>
                                <artifactId>hibernate-jpamodelgen</artifactId>
                                <version>${version.hibernate}</version>
                            </dependency>
                            <dependency>
                                <groupId>jakarta.xml.bind</groupId>
                                <artifactId>jakarta.xml.bind-api</artifactId>
                                <version>${version.jaxb-api}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.sun.xml.bind</groupId>
                                <artifactId>jaxb-impl</artifactId>
                                <version>${version.jaxb}</version>
                            </dependency>
                            <dependency>
                                <groupId>jakarta.transaction</groupId>
                                <artifactId>jakarta.transaction-api</artifactId>
                                <version>${version.jta}</version>
                            </dependency>
                            <dependency>
                                <groupId>jakarta.activation</groupId>
                                <artifactId>jakarta.activation-api</artifactId>
                                <version>${version.activation}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source-metamodel</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.build.directory}/metamodel</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>