<?xml version="1.0" encoding="UTF-8"?>
<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>

    <groupId>org.omnifaces</groupId>
    <artifactId>omniservices</artifactId>
    <version>0.2</version>
    <packaging>jar</packaging>

    <name>OmniServices</name>
    <description>Utility library that provides EJB3-like features for CDI beans</description>
    <url>https://github.com/omnifaces/omniservices</url>
    <organization>
        <name>OmniFaces</name>
        <url>https://omnifaces.org</url>
    </organization>
    <inceptionYear>2016</inceptionYear>

    <developers>
        <developer>
            <id>balusc</id>
            <name>Bauke Scholtz</name>
            <email>balusc@gmail.com</email>
        </developer>
        <developer>
            <id>arjan.tijms</id>
            <name>Arjan Tijms</name>
            <email>arjan.tijms@gmail.com</email>
        </developer>
        <developer>
            <id>jan.beernink</id>
            <name>Jan Beernink</name>
            <email>jan.beernink@gmail.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/omnifaces/omniservices</url>
        <connection>scm:git:git://github.com/omnifaces/omniservices.git</connection>
        <developerConnection>scm:git:git@github.com:omnifaces/omniservices.git</developerConnection>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <maven.compiler.release>11</maven.compiler.release>

        <!-- Essential Maven defaults. -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Test versions. -->
        <jacoco.version>0.8.7</jacoco.version>
        
        <piranha.version>22.10.0</piranha.version>
        <glassfish6.version>6.2.5</glassfish6.version>
        <payara5.version>5.2021.9</payara5.version>
        <wildfly.version>25.0.1.Final</wildfly.version>
        <tomee9.version>9.0.0-M7</tomee9.version>
        <liberty.version>21.0.0.12</liberty.version>
        <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
        

        <!-- OmniFaces dependencies. -->
        <dependency>
            <groupId>org.omnifaces</groupId>
            <artifactId>omniutils</artifactId>
            <version>0.13</version>
        </dependency>

        <!-- Test dependencies.	-->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.junit5</groupId>
            <artifactId>arquillian-junit5-container</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.arquillian.protocol</groupId>
            <artifactId>arquillian-protocol-servlet-jakarta</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-depchain</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>

        <!--        <dependency>-->
        <!--            <groupId>org.jboss.arquillian.extension</groupId>-->
        <!--            <artifactId>arquillian-jacoco</artifactId>-->
        <!--            <version>1.0.0.Alpha8</version>-->
        <!--            <scope>test</scope>-->
        <!--        </dependency>-->
        <!--        <dependency>-->
        <!--            <groupId>org.jacoco</groupId>-->
        <!--            <artifactId>org.jacoco.core</artifactId>-->
        <!--            <version>${jacoco.version}</version>-->
        <!--            <scope>test</scope>-->
        <!--        </dependency>-->
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <!-- Test dependencies.	-->
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.7.0.Alpha13</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.8.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>

            <!-- Add missing license headers to source files. -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <header>license.txt</header>
                    <excludes>
                        <exclude>*.*</exclude>
                    </excludes>
                    <mapping>
                        <java>SLASHSTAR_STYLE</java>
                    </mapping>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Configure the jar with the binaries. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <URL>${project.url}</URL>
                            <Extension-Name>${project.artifactId}</Extension-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- Configure the jar with the sources. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Configure the jar with the javadoc. -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <quiet>true</quiet>
                    <notimestamp>true</notimestamp>
                    <splitindex>true</splitindex>
                    <doctitle>OmniServices API documentation</doctitle>
                    <links>
                        <link>https://javaee.github.io/javaee-spec/javadocs/</link>
                    </links>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Configure snapshot deployment to Sonatype. -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.8</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>external.atlassian.jgitflow</groupId>
                <artifactId>jgitflow-maven-plugin</artifactId>
                <version>1.0-m5.1</version>
                <configuration>
                    <noDeploy>true</noDeploy>
                    <enableFeatureVersions>true</enableFeatureVersions>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
            </plugin>
            
            <!-- Configure snapshot deployment to Sonatype. -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.13</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>

                <!-- Make sure Eclipse itself also runs license format during build. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.mycila</groupId>
                                        <artifactId>license-maven-plugin</artifactId>
                                        <versionRange>[3.0,)</versionRange>
                                        <goals>
                                            <goal>format</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute>
                                            <runOnConfiguration>true</runOnConfiguration>
                                        </execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>piranha-micro</id>
             <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
    
            <dependencies>
                <dependency>
                    <groupId>cloud.piranha.arquillian</groupId>
                    <artifactId>piranha-arquillian-server</artifactId>
                    <version>${piranha.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    
        <profile>
            <id>glassfish6</id>

            <dependencies>
                <dependency>
                    <groupId>org.glassfish.main.extras</groupId>
                    <artifactId>glassfish-embedded-all</artifactId>
                    <version>${glassfish6.version}</version>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>org.omnifaces.arquillian</groupId>
                    <artifactId>arquillian-glassfish-server-embedded</artifactId>
                    <version>1.0</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>payara5</id>

            <dependencies>
                <dependency>
                    <groupId>fish.payara.extras</groupId>
                    <artifactId>payara-embedded-all</artifactId>
                    <version>${payara5.version}</version>
                    <scope>test</scope>
                </dependency>

                <dependency>
                    <groupId>fish.payara.arquillian</groupId>
                    <artifactId>arquillian-payara-server-embedded</artifactId>
                    <version>2.4.5</version>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>wildfly</id>

            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <version>4.0.0.Alpha3</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-preview-dist</artifactId>
                                            <version>${wildfly.version}</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <configuration>
                            <systemPropertyVariables>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            </systemPropertyVariables>
                            <environmentVariables>
                                <JBOSS_HOME>${project.build.directory}/wildfly-preview-${wildfly.version}</JBOSS_HOME>
                                <module.path>${project.build.directory}/wildfly-preview-${wildfly.version}/modules</module.path>
                            </environmentVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>tomee9</id>

            <dependencies>
                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>apache-tomee</artifactId>
                    <version>${tomee9.version}</version>
                    <scope>test</scope>
                    <type>zip</type>
                    <classifier>plus</classifier>
                </dependency>

                <dependency>
                    <groupId>org.apache.tomee</groupId>
                    <artifactId>arquillian-tomee-remote</artifactId>
                    <version>8.0.7</version>
                    <scope>test</scope>
                    <exclusions>
                        <exclusion>
                            <groupId>org.apache.tomee</groupId>
                            <artifactId>arquillian-openejb-transaction-provider</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <configuration>
                            <argLine>-DTOMEE_LOCK_FILE=${user.dir}/.tomee-ports.lock</argLine>
                            <systemPropertyVariables>
                                <tomee.stopPort>-1</tomee.stopPort>
                                <tomee.httpPort>-1</tomee.httpPort>
                                <tomee.httpsPort>-1</tomee.httpsPort>
                                <tomee.ajpPort>-1</tomee.ajpPort>

                                <tomee.dir>target/tomee/server</tomee.dir>
                                <tomee.appWorkingDir>target/tomee/arquillian</tomee.appWorkingDir>
                                <tomee.cleanOnStartUp>true</tomee.cleanOnStartUp>
                                <tomee.classifier>plus</tomee.classifier>
                                <tomee.properties>
                                    openejb.environment.default=true
                                </tomee.properties>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <profile>
            <id>liberty</id>

            <dependencies>
                <dependency>
                    <groupId>io.openliberty.arquillian</groupId>
                    <artifactId>arquillian-liberty-managed-jakarta</artifactId>
                    <version>2.0.1</version>
                    <scope>test</scope>
                </dependency>

            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>io.openliberty</groupId>
                                            <artifactId>openliberty-runtime</artifactId>
                                            <version>${liberty.version}</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <echo>Copying server.xml</echo>
                                        <copy
                                                file="src/test/resources/server.xml"
                                                tofile="${project.build.directory}/wlp/templates/servers/defaultServer/server.xml"
                                        />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <configuration>
                            <systemPropertyVariables>
                                <arquillian.launch>liberty</arquillian.launch>
                                <arquillian.liberty.wlpHome>${project.build.directory}/wlp</arquillian.liberty.wlpHome>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>


        <!-- Release deploy: mvn clean deploy -P release -->
        <profile>
            <id>release</id>
            <build>
                <plugins>

                    <!-- Signing with GPG is a requirement for a release deployment to Maven central. -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
