<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2023 Brinvex (dev@brinvex.com)

    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>

    <groupId>com.brinvex.util</groupId>
    <artifactId>brinvex-util-persistence</artifactId>
    <version>1.0.1</version>
    <packaging>pom</packaging>

    <name>Brinvex Persistence Util</name>
    <description>
        Brinvex-Util-Persistence is a compact Java library that adds utilities for Jakarta-JPA / Hibernate.
    </description>
    <url>https://github.com/brinvex/brinvex-util-persistence</url>
    <inceptionYear>2023</inceptionYear>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Lukas</name>
            <email>dev@brinvex.com</email>
            <organization>Brinvex</organization>
            <organizationUrl>https://brinvex.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com:brinvex/brinvex-util-persistence.git</connection>
        <developerConnection>scm:git:https://github.com/brinvex/brinvex-util-persistence.git</developerConnection>
        <url>scm:git:https://github.com/brinvex/brinvex-util-persistence/tree/master</url>
        <tag>brinvex-util-persistence-1.0.1</tag>
    </scm>

    <modules>
        <module>brinvex-util-persistence-api</module>
        <module>brinvex-util-persistence-impl</module>
    </modules>

    <properties>
        <java.version>11</java.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.showWarnings>true</maven.compiler.showWarnings>
        <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>

        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>

        <jakarta.persistence-api.version>3.1.0</jakarta.persistence-api.version>

        <slf4j-api.version>2.0.6</slf4j-api.version>
        <logback-classic.version>1.4.5</logback-classic.version>

        <junit-jupiter.version>5.9.2</junit-jupiter.version>
        <hibernate-orm.version>6.2.0.CR3</hibernate-orm.version>
        <postgresql.version>42.5.4</postgresql.version>


        <rootDir>${project.basedir}</rootDir>
        <isPomPackagingModule>true</isPomPackagingModule>
    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.brinvex.util</groupId>
                <artifactId>brinvex-util-persistence-api</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>jakarta.persistence</groupId>
                <artifactId>jakarta.persistence-api</artifactId>
                <version>${jakarta.persistence-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.orm</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${hibernate-orm.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.orm</groupId>
                <artifactId>hibernate-jpamodelgen</artifactId>
                <version>${hibernate-orm.version}</version>
            </dependency>

            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgresql.version}</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback-classic.version}</version>
            </dependency>

            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit-jupiter.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <!-- https://stackoverflow.com/questions/36970384/surefire-is-not-picking-up-junit-5-tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>

            <properties>
                <activate-settings-xml-gpg-properties>true</activate-settings-xml-gpg-properties>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <version>4.1</version>
                        <configuration>
                            <properties>
                                <owner>Brinvex</owner>
                                <email>dev@brinvex.com</email>
                            </properties>
                            <licenseSets>
                                <licenseSet>
                                    <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                                    <excludes>
                                        <exclude>src/main/resources/**</exclude>
                                        <exclude>src/test/resources/**</exclude>
                                        <exclude>**/.gitignore</exclude>
                                        <exclude>**/changelog.txt</exclude>
                                        <exclude>**/.LICENSE</exclude>
                                        <exclude>**/.README</exclude>
                                    </excludes>
                                </licenseSet>
                            </licenseSets>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>copy-resource-license</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <skip>${isPomPackagingModule}</skip>
                                    <outputDirectory>${project.basedir}/src/main/resources/META-INF</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${rootDir}</directory>
                                            <includes>
                                                <include>LICENSE</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <inherited>true</inherited>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doclint>all,-missing</doclint>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <configuration>
                            <keyname>${gpg.keyname}</keyname>
                            <passphrase>${gpg.passphrase}</passphrase>
                            <executable>${gpg.executable}</executable>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>${maven-release-plugin.version}</version>
                        <configuration>
                            <autoVersionSubmodules>true</autoVersionSubmodules>
                            <useReleaseProfile>false</useReleaseProfile>
                            <releaseProfiles>release,settings-xml-gpg-properties</releaseProfiles>
                            <goals>deploy</goals>
                            <pushChanges>false</pushChanges>
                            <scmCommentPrefix xml:space="preserve">release: </scmCommentPrefix>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

</project>