<?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" child.project.url.inherit.append.path="false">

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.instancio</groupId>
    <artifactId>instancio-parent</artifactId>
    <version>5.3.0</version>
    <packaging>pom</packaging>

    <name>Instancio Parent</name>
    <description>Instancio is a library for auto-populating objects with random data.</description>
    <url>https://www.instancio.org</url>
    <organization>
        <name>Instancio</name>
        <url>https://www.instancio.org</url>
    </organization>

    <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>
            <id>armandino</id>
            <name>Arman Sharif</name>
            <email>instancio@pm.me</email>
            <url>https://github.com/armandino</url>
        </developer>
    </developers>

    <scm child.scm.url.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.connection.inherit.append.path="false">
        <url>https://github.com/instancio/instancio</url>
        <connection>scm:git:https://github.com/instancio/instancio.git</connection>
        <developerConnection>scm:git:https://github.com/instancio/instancio.git</developerConnection>
        <tag>instancio-parent-5.3.0</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-snapshots</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-staging</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.enforcer.require.java.version>[23,)</maven.enforcer.require.java.version>
        <sonar.organization>instancio</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <!--suppress UnresolvedMavenProperty -->
        <sonar.coverage.jacoco.xmlReportPaths>
            ${maven.multiModuleProjectDirectory}/instancio-tests/report-aggregate/target/site/jacoco-aggregate/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
        <latest.release.version>5.3.0</latest.release.version>
        <version.guava>33.4.0-jre</version.guava>
        <version.hibernate.validator>8.0.0.Final</version.hibernate.validator>
        <version.highlight.js>11.9.0</version.highlight.js>
        <version.jackson>2.18.2</version.jackson>
        <version.jakarta.persistence>3.0.0</version.jakarta.persistence>
        <version.jakarta.validation>3.1.0</version.jakarta.validation>
        <version.javax.persistence>2.2</version.javax.persistence>
        <version.javax.validation>2.0.1.Final</version.javax.validation>
        <version.jetbrains.annotations>26.0.1</version.jetbrains.annotations>
        <version.junit>5.11.4</version.junit>
        <version.slf4j>2.0.16</version.slf4j>
        <!-- plugins -->
        <version.animal-sniffer-maven-plugin>1.24</version.animal-sniffer-maven-plugin>
        <version.jacoco-maven-plugin>0.8.12</version.jacoco-maven-plugin>
        <version.maven-antrun-plugin>3.1.0</version.maven-antrun-plugin>
        <version.maven-bundle-plugin>6.0.0</version.maven-bundle-plugin>
        <version.maven-checkstyle-plugin>3.6.0</version.maven-checkstyle-plugin>
        <version.maven-compiler-plugin>3.13.0</version.maven-compiler-plugin>
        <version.maven-deploy-plugin>3.1.3</version.maven-deploy-plugin>
        <version.maven-enforcer-plugin>3.5.0</version.maven-enforcer-plugin>
        <version.maven-gpg-plugin>3.2.7</version.maven-gpg-plugin>
        <version.maven-jar-plugin>3.4.2</version.maven-jar-plugin>
        <version.maven-javadoc-plugin>3.11.2</version.maven-javadoc-plugin>
        <version.maven-pmd-plugin>3.26.0</version.maven-pmd-plugin>
        <version.maven-release-plugin>2.5.3</version.maven-release-plugin>
        <version.maven-site-plugin>3.21.0</version.maven-site-plugin>
        <version.maven-source-plugin>3.3.1</version.maven-source-plugin>
        <version.sonar-maven-plugin>5.0.0.4389</version.sonar-maven-plugin>
        <version.spotbugs-maven-plugin>4.8.6.6</version.spotbugs-maven-plugin>
        <version.versions-maven-plugin>2.18.0</version.versions-maven-plugin>
    </properties>

    <issueManagement>
        <system>Github</system>
        <url>https://github.com/instancio/instancio/issues</url>
    </issueManagement>

    <modules>
        <module>build-tools</module>
        <module>instancio-core</module>
        <module>instancio-junit</module>
        <module>instancio-guava</module>
        <module>instancio-tests</module>
    </modules>

    <profiles>
        <profile>
            <id>release</id>
            <modules>
                <module>instancio-core</module>
                <module>instancio-junit</module>
                <module>instancio-guava</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>update-latest-release-version</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>versions-maven-plugin</artifactId>
                        <configuration>
                            <property>latest.release.version</property>
                            <newVersion>${project.version}</newVersion>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>instancio-library</id>
            <activation>
                <file>
                    <exists>${basedir}/instancio-library.marker</exists>
                </file>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <version>${version.maven-compiler-plugin}</version>
                            <executions>
                                <execution>
                                    <id>default-compile</id>
                                    <configuration>
                                        <release>9</release>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>base-compile</id>
                                    <goals>
                                        <goal>compile</goal>
                                    </goals>
                                    <configuration>
                                        <excludes>
                                            <exclude>module-info.java</exclude>
                                        </excludes>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>java-16</id>
                                    <phase>compile</phase>
                                    <goals>
                                        <goal>compile</goal>
                                    </goals>
                                    <configuration>
                                        <release>16</release>
                                        <compileSourceRoots>
                                            <compileSourceRoot>${project.basedir}/src/main/java16
                                            </compileSourceRoot>
                                        </compileSourceRoots>
                                        <multiReleaseOutput>true</multiReleaseOutput>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>java-17</id>
                                    <phase>compile</phase>
                                    <goals>
                                        <goal>compile</goal>
                                    </goals>
                                    <configuration>
                                        <release>17</release>
                                        <compileSourceRoots>
                                            <compileSourceRoot>${project.basedir}/src/main/java17
                                            </compileSourceRoot>
                                        </compileSourceRoots>
                                        <multiReleaseOutput>true</multiReleaseOutput>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>java-21</id>
                                    <phase>compile</phase>
                                    <goals>
                                        <goal>compile</goal>
                                    </goals>
                                    <configuration>
                                        <release>21</release>
                                        <compileSourceRoots>
                                            <compileSourceRoot>${project.basedir}/src/main/java21
                                            </compileSourceRoot>
                                        </compileSourceRoots>
                                        <multiReleaseOutput>true</multiReleaseOutput>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-antrun-plugin</artifactId>
                            <version>${version.maven-antrun-plugin}</version>
                            <executions>
                                <execution>
                                    <id>move-module-info</id>
                                    <phase>prepare-package</phase>
                                    <goals>
                                        <goal>run</goal>
                                    </goals>
                                    <configuration>
                                        <target>
                                            <move file="${project.basedir}/target/classes/module-info.class" todir="${project.basedir}/target/classes/META-INF/versions/9" failonerror="false" quiet="true" />
                                        </target>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <configuration>
                            <archive>
                                <manifestEntries>
                                    <Multi-Release>true</Multi-Release>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${version.maven-enforcer-plugin}</version>
                    <executions>
                        <execution>
                            <id>default-cli</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <dependencyConvergence />
                                    <requireJavaVersion>
                                        <version>${maven.enforcer.require.java.version}</version>
                                    </requireJavaVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.maven-compiler-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${version.maven-source-plugin}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${version.versions-maven-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${version.jacoco-maven-plugin}</version>
                    <configuration>
                        <!-- jacoco does not support multi-release jars -->
                        <excludes>
                            <exclude>META-INF/**</exclude>
                        </excludes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${version.maven-pmd-plugin}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.instancio</groupId>
                            <artifactId>build-tools</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                                <goal>cpd-check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <printFailingErrors>true</printFailingErrors>
                        <failOnViolation>true</failOnViolation>
                        <failurePriority>4</failurePriority>
                        <minimumTokens>120</minimumTokens>
                        <rulesets>
                            <ruleset>pmd-rules.xml</ruleset>
                        </rulesets>
                        <excludeRoots>
                            <excludeRoot>target/generated-sources/</excludeRoot>
                        </excludeRoots>
                        <linkXRef>false</linkXRef>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.maven-checkstyle-plugin}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>10.21.1</version>
                        </dependency>
                        <dependency>
                            <groupId>org.instancio</groupId>
                            <artifactId>build-tools</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>checkstyle.xml</configLocation>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${version.sonar-maven-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${version.maven-javadoc-plugin}</version>
                    <configuration>
                        <source>8</source>
                        <!-- Some public APIs extend package-private classes.
                             This ensures {@inheritDoc} works in such cases. -->
                        <show>package</show>
                        <encoding>UTF-8</encoding>
                        <docencoding>UTF-8</docencoding>
                        <charset>UTF-8</charset>
                        <additionalOptions>-html5 --allow-script-in-comments</additionalOptions>
                        <nohelp>true</nohelp>
                        <javadocDirectory>${maven.multiModuleProjectDirectory}/build-tools/src/main/javadoc</javadocDirectory>
                        <addStylesheets>
                            <stylesheet>instancio-theme.css</stylesheet>
                            <stylesheet>hljs-theme.css</stylesheet>
                        </addStylesheets>
                        <bottom><![CDATA[
                        Copyright &#169; {currentYear} <a href="https://www.instancio.org">Instancio</a>. All rights reserved.
                        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${version.highlight.js}/highlight.min.js"></script>
                        <script>hljs.configure({languages:['java']});hljs.initHighlightingOnLoad();</script>
                        ]]></bottom>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.maven-jar-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>${version.maven-bundle-plugin}</version>
                    <executions>
                        <execution>
                            <id>bundle-manifest</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>manifest</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${version.maven-gpg-plugin}</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <keyname>${gpg.keyname}</keyname>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${version.maven-deploy-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${version.maven-release-plugin}</version>
                    <configuration>
                        <preparationGoals>versions:set-property versions:commit verify</preparationGoals>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                        <localCheckout>true</localCheckout>
                        <arguments>-Pupdate-latest-release-version</arguments>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>animal-sniffer-maven-plugin</artifactId>
                    <version>${version.animal-sniffer-maven-plugin}</version>
                    <configuration>
                        <signature>
                            <groupId>org.codehaus.mojo.signature</groupId>
                            <artifactId>java18</artifactId>
                            <version>1.0</version>
                        </signature>
                        <annotations>
                            <annotation>org.instancio.internal.util.IgnoreJRERequirement</annotation>
                        </annotations>
                        <checkTestClasses>true</checkTestClasses>
                    </configuration>
                    <executions>
                        <execution>
                            <id>animal-sniffer</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${version.maven-ant-plugin}</version>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${version.spotbugs-maven-plugin}</version>
                    <configuration>
                        <failOnError>true</failOnError>
                        <threshold>Low</threshold>
                        <effort>max</effort>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${version.maven-site-plugin}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${version.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>jakarta.persistence</groupId>
                <artifactId>jakarta.persistence-api</artifactId>
                <version>${version.jakarta.persistence}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>jakarta.validation</groupId>
                <artifactId>jakarta.validation-api</artifactId>
                <version>${version.jakarta.validation}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>javax.persistence</groupId>
                <artifactId>javax.persistence-api</artifactId>
                <version>${version.javax.persistence}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${version.javax.validation}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.hibernate.validator</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>${version.hibernate.validator}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${version.jackson}</version>
                <scope>provided</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>${version.jetbrains.annotations}</version>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.junit}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>oss-snapshot-repository</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>
