<?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>ee.omnifish</groupId>
    <artifactId>omnibeans</artifactId>
    <version>0.2</version>
    <packaging>jar</packaging>

    <name>OmniBeans</name>
    <description>Jakarta Enterprise Beans Lite implementation using CDI</description>
    <url>https://github.com/OmniFish-EE/omni-beans</url>
    <inceptionYear>2016</inceptionYear>
    <organization>
        <name>OmniFish</name>
        <url>https://omnifish.ee</url>
    </organization>
    <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>

    <developers>
        <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>

    <scm>
        <url>https://github.com/OmniFish-EE/omni-beans</url>
        <connection>scm:git:git://github.com/OmniFish-EE/omni-beans.git</connection>
        <developerConnection>scm:git:git@github.com:OmniFish-EE/omni-beans.git</developerConnection>
    </scm>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <module.name>ee.omnifish.omnibeans</module.name>

        <maven.compiler.release>11</maven.compiler.release>
        <jakartaee.version>10.0.0</jakartaee.version>

        <!-- 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>
        <maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
    </properties>

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

       

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

    <build>
        <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>
        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.6.0</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
            </plugin>

            <!-- Add missing license headers to source files. -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>4.2.rc2</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.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <URL>${project.url}</URL>
                            <Extension-Name>${project.artifactId}</Extension-Name>
                            <Automatic-Module-Name>${module.name}</Automatic-Module-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.4.1</version>
                <configuration>
                    <quiet>true</quiet>
                    <notimestamp>true</notimestamp>
                    <splitindex>true</splitindex>
                    <doctitle>OmniBeans 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>

            <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-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://s01.oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- Release deploy: mvn clean deploy -P release -->
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Signing with GPG is a requirement for a release deployment to Maven central. -->
                    <plugin>
                        <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>
