<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.dellroad</groupId>
        <artifactId>dellroad-dependencies</artifactId>
        <version>4.0.5.6</version>
    </parent>
    <groupId>org.dellroad</groupId>
    <artifactId>hibernate-jpa-schemagen</artifactId>
    <version>7.2.2</version>
    <name>Hibernate+JPA Schema Generator</name>
    <packaging>pom</packaging>
    <description>Sensible Maven schema DDL generator for projects using Hibernate and JPA</description>
    <url>https://github.com/archiecobbs/hibernate-jpa-schemagen/</url>
    <modules>
        <module>core</module>
        <module>maven-plugin</module>
        <module>test</module>
    </modules>
    <properties>
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <hibernate.version>7.2.11.Final</hibernate.version>
        <hibernate.short.version>7.2</hibernate.short.version><!-- this should agree with ${hibernate.version} -->
        <hibernate-jpa-schemagen.package.root>org.dellroad.hibernate.schemagen</hibernate-jpa-schemagen.package.root>
    </properties>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/archiecobbs/hibernate-jpa-schemagen/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/archiecobbs/hibernate-jpa-schemagen/</url>
        <connection>scm:git:git://github.com/archiecobbs/hibernate-jpa-schemagen.git</connection>
        <developerConnection>scm:git:git://github.com/archiecobbs/hibernate-jpa-schemagen.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>archie</id>
            <name>Archie Cobbs</name>
            <email>archie.cobbs@gmail.com</email>
        </developer>
    </developers>
    <distributionManagement>
        <downloadUrl>https://github.com/archiecobbs/hibernate-jpa-schemagen</downloadUrl>
        <site>
            <id>${project.artifactId}-site</id>
            <url>https://github.com/archiecobbs/hibernate-jpa-schemagen/</url>
        </site>
    </distributionManagement>
    <build>
        <plugins>

            <!-- Maven Enforcer -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>extra-enforcer-rules</artifactId>
                        <version>${extra-enforcer-rules.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>maven_enforcer</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[17,18)</version>
                                </requireJavaVersion>
                                <enforceBytecodeVersion>
                                    <maxJdkVersion>${java.version}</maxJdkVersion>
                                </enforceBytecodeVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>${automatic.module.name}</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- Compile -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>${java.version}</release>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint:all,-processing,-path</arg>
                    <!--
                        <arg>-Werror</arg>
                    -->
                    </compilerArgs>
                </configuration>
            </plugin>

            <!-- Sources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <source>${javadoc.target}</source>
                    <notimestamp>true</notimestamp>
                    <validateLinks>true</validateLinks>
                    <doclint>all,-missing</doclint>
                    <additionalJOptions>
                        <additionalJOption>-Xmaxwarns</additionalJOption>
                        <additionalJOption>65536</additionalJOption>
                    </additionalJOptions>
                    <links combine.children="append">
                        <link>https://docs.hibernate.org/orm/${hibernate.short.version}/javadocs/</link>
                        <link>https://www.slf4j.org/apidocs/</link>
                        <link>https://maven.apache.org/ref/${plugin-api.version}/apidocs/</link>
                    </links>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>--add-opens=java.base/java.text=ALL-UNNAMED</argLine>
                    <systemPropertyVariables>
                        <deleteTempDirs>true</deleteTempDirs>
                        <randomSeed/>
                    </systemPropertyVariables>
                    <properties>
                        <property>
                            <name>surefire.testng.verbose</name>
                            <value>10</value>
                        </property>
                    </properties>
                    <useModulePath>false</useModulePath>
                </configuration>
            </plugin>

            <!-- Checkstyle -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>checkstyle_verify</id>
                        <phase>compile</phase>
                        <configuration>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <linkXRef>false</linkXRef>
                            <includeResources>false</includeResources>
                            <includeTestResources>false</includeTestResources>
                            <sourceDirectories>
                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                                <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
                            </sourceDirectories>
                            <configLocation>src/checkstyle/checkstyle.xml</configLocation>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- SpotBugs -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Default</threshold>
                    <xmlOutput>true</xmlOutput>
                    <excludeFilterFile>src/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
                    <failOnError>true</failOnError>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Deployment -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <autoPublish>true</autoPublish>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>

        <!-- Use "mvn -P central deploy" to deploy to Maven Central -->
        <profile>
            <id>central</id>
            <build>
                <plugins>

                    <!--
                        Maven Central requires signed artifacts. You can use
                        "-Dgpg.keyname=foo" to specify a specific private key.
                    -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Deploy to Maven Central and publish -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
