<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>
    <packaging>pom</packaging>
    
    <groupId>io.gdcc</groupId>
    <artifactId>parent</artifactId>
    <version>0.10.2</version>
    
    <organization>
        <name>Global Dataverse Community Consortium</name>
        <url>https://www.gdcc.io</url>
    </organization>
    
    <name>Universal GDCC Parent POM</name>
    <url>https://github.com/${project.github.org}</url>
    <description>Parent POM for easy coordination of all GDCC and IQSS Dataverse-related Java project POMs</description>
    
    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    
    <developers>
        <developer>
            <name>Oliver Bertuch</name>
            <url>https://github.com/poikilotherm</url>
            <email>maven-parent@gdcc.io</email>
            <organization>Forschungszentrum Jülich GmbH</organization>
            <organizationUrl>https://www.fz-juelich.de/en/zb</organizationUrl>
        </developer>
    </developers>
    
    <issueManagement>
        <url>https://github.com/${project.github.org}/${project.github.repo}/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>
    
    <scm>
        <connection>scm:git:git@github.com:${project.github.org}</connection>
        <developerConnection>scm:git:git@github.com:${project.github.org}</developerConnection>
        <url>git@github.com:${project.github.org}</url>
        <tag>HEAD</tag>
    </scm>
    
    <ciManagement>
        <url>https://github.com/${project.github.org}/${project.github.repo}/actions</url>
        <system>github</system>
        <notifiers>
            <notifier>
                <address>dataversebot@gdcc.io</address>
            </notifier>
        </notifiers>
    </ciManagement>
    
    <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>
    
    <properties>
        <!-- This needs to be the least common denominator!
             The XOAI/sitemap/SWORD projects use Java 11 to be more compatible -->
        <jdk.version>11</jdk.version>
        
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <javadoc.lint>none</javadoc.lint>
        <!-- Needed to avoid IDEA IDE compilation failures. See commits in GH #5059 -->
        <compilerArgument />
        <project.timezone>UTC</project.timezone>
        <project.language>en</project.language>
        <project.region>US</project.region>
        <project.github.org>gdcc</project.github.org>
        <project.github.repo>${project.artifactId}</project.github.repo>
        <argLine>-Duser.timezone=${project.timezone} -Dfile.encoding=${project.build.sourceEncoding} -Duser.language=${project.language} -Duser.region=${project.region}</argLine>
        <skipUT>false</skipUT>
        <skipIT>false</skipIT>
        <skipFlatten>true</skipFlatten>
        <skipEnforce.junit5>false</skipEnforce.junit5>
        <skipEnforce.jdk-version>false</skipEnforce.jdk-version>
        <skipEnforce.log-libs>true</skipEnforce.log-libs>
        <skipEnforce.convergence>true</skipEnforce.convergence>
        <skipEnforce.pomcheck-warn-is-no-error>false</skipEnforce.pomcheck-warn-is-no-error>
        <skipSign>false</skipSign>
        <skipRelease>false</skipRelease>
        
        <!-- Dependencies -->
        <dataverse.spi.version>2.0.0</dataverse.spi.version>
        <google.auto.service.version>1.1.1</google.auto.service.version>
        <slf4j.version>2.0.16</slf4j.version>
        
        <!-- Testing dependencies -->
        <junit.jupiter.version>5.11.2</junit.jupiter.version>
        <xmlunit.version>2.10.0</xmlunit.version>
        <hamcrest.version>3.0</hamcrest.version>
        <jsonassert.version>1.5.3</jsonassert.version>
        
        <!-- Official Maven Plugins -->
        <maven-plugin-api.version>3.8.2</maven-plugin-api.version>
        <maven-plugin-annotations.version>3.6.4</maven-plugin-annotations.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <maven-war-plugin.version>3.4.0</maven-war-plugin.version>
        <maven-dependency-plugin.version>3.8.0</maven-dependency-plugin.version>
        <maven-surefire-plugin.version>3.5.1</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.5.1</maven-failsafe-plugin.version>
        <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
        <maven-plugin-plugin.version>3.15.0</maven-plugin-plugin.version>
        <maven-site-plugin.version>4.0.0-M16</maven-site-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.10.1</maven-javadoc-plugin.version>
        <maven-flatten-plugin.version>1.6.0</maven-flatten-plugin.version>
        <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
        <maven-release-plugin.version>3.1.1</maven-release-plugin.version>
        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
        <maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
        
        <pomchecker.version>1.13.0</pomchecker.version>
        <nexus-staging-plugin.version>1.7.0</nexus-staging-plugin.version>
        <checkstyle-maven-plugin.version>3.5.0</checkstyle-maven-plugin.version>
        <checkstyle.version>10.18.2</checkstyle.version>
        <spotbugs-maven-plugin.version>4.8.6.4</spotbugs-maven-plugin.version>
        <jacoco.version>0.8.12</jacoco.version>
        <sonar.version>4.0.0.4121</sonar.version>
        <spotless.version>2.43.0</spotless.version>
    </properties>
    
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${maven-enforcer-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven-war-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven-plugin-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>${maven-flatten-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.kordamp.maven</groupId>
                    <artifactId>pomchecker-maven-plugin</artifactId>
                    <version>${pomchecker.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>${nexus-staging-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${checkstyle-maven-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>${spotbugs-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${sonar.version}</version>
                </plugin>
                <plugin>
                    <groupId>com.diffplug.spotless</groupId>
                    <artifactId>spotless-maven-plugin</artifactId>
                    <version>${spotless.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>${jdk.version}</release>
                    <compilerArgument>${compilerArgument}</compilerArgument>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            
            <!-- TESTING -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>${skipUT}</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <skipTests>${skipIT}</skipTests>
                </configuration>
            </plugin>
            
            <!-- RELEASING -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <skipStaging>${skipRelease}</skipStaging>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://s01.oss.sonatype.org</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.kordamp.maven</groupId>
                <artifactId>pomchecker-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <configuration>
                    <skipFlatten>${skipFlatten}</skipFlatten>
                    <updatePomFile>true</updatePomFile>
                    <flattenMode>oss</flattenMode>
                    <pomElements>
                        <distributionManagement>remove</distributionManagement>
                        <repositories>remove</repositories>
                    </pomElements>
                </configuration>
                <executions>
                    <!-- enable flattening -->
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <!-- ensure proper cleanup -->
                    <execution>
                        <id>flatten.clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            <!-- META -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>no-junit4</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <skip>${skipEnforce.junit5}</skip>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>junit:junit:*:*:test</exclude>
                                        <exclude>org.junit:junit:*:*:test</exclude>
                                        <exclude>org.junit.vintage:*:*:*:test</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>no-other-logging-libs</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <skip>${skipEnforce.log-libs}</skip>
                            <rules>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>org.apache.logging.log4j:log4j-api:*:*:*</exclude>
                                        <exclude>org.apache.logging.log4j:log4j-core:*:*:*</exclude>
                                        <exclude>ch.qos.logback:logback-classic:*:*:*</exclude>
                                        <exclude>log4j:log4j:*:*:*</exclude>
                                        <exclude>ch.qos.reload4j:reload4j:*:*:*</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>general-reqs</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <skip>${skipEnforce.jdk-version}</skip>
                            <rules>
                                <banDuplicatePomDependencyVersions/>
                                <requireJavaVersion>
                                    <version>[${jdk.version}.0,)</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>[3.6.3,)</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dep-convergence</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <skip>${skipEnforce.convergence}</skip>
                            <rules>
                                <dependencyConvergence/>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
    <dependencyManagement>
        <dependencies>
            <!-- Common interfaces for exporter plugins -->
            <dependency>
                <groupId>io.gdcc</groupId>
                <artifactId>dataverse-spi</artifactId>
                <version>${dataverse.spi.version}</version>
            </dependency>
            <!-- Required to be used by a plugin to be discoverable -->
            <dependency>
                <groupId>com.google.auto.service</groupId>
                <artifactId>auto-service</artifactId>
                <version>${google.auto.service.version}</version>
            </dependency>
            
            <!-- Logging facade -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            
            <!-- TESTING DEPENDENCIES -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.jupiter.version}</version>
            </dependency>
            <dependency>
                <groupId>org.xmlunit</groupId>
                <artifactId>xmlunit-core</artifactId>
                <version>${xmlunit.version}</version>
            </dependency>
            <dependency>
                <groupId>org.xmlunit</groupId>
                <artifactId>xmlunit-matchers</artifactId>
                <version>${xmlunit.version}</version>
                <!--
                This library relies on the outdated hamcrest 1.3. As hamcrest changed the artifactId from hamcrest-core
                to just hamcrest and the API is the very same, we simply exclude it here and let it pick up the newer
                hamcrest library on the classpath.
                 -->
                <exclusions>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-core</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest</artifactId>
                <version>${hamcrest.version}</version>
            </dependency>
            <dependency>
                <groupId>org.skyscreamer</groupId>
                <artifactId>jsonassert</artifactId>
                <version>${jsonassert.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
    <profiles>
        <profile>
            <id>coverage</id>
            <properties>
                <sonar.host.url>https://sonarcloud.io</sonar.host.url>
                <sonar.organization>${project.github.org}</sonar.organization>
                <sonar.projectKey>${project.github.org}_${project.github.repo}</sonar.projectKey>
                <sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
                <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>org.kordamp.maven</groupId>
                                <artifactId>pomchecker-enforcer-rules</artifactId>
                                <version>${pomchecker.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>enforce</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <phase>verify</phase>
                                <configuration>
                                    <rules>
                                        <CheckMavenCentral implementation="org.kordamp.maven.enforcer.checker.CheckMavenCentral">
                                            <failOnWarning>!${skipEnforce.pomcheck-warn-is-no-error}</failOnWarning>
                                            <release>!${skipRelease}</release>
                                        </CheckMavenCentral>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <configuration>
                                    <skip>${skipSign}</skip>
                                </configuration>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <source>${jdk.version}</source>
                            <detectJavaApiLink>false</detectJavaApiLink>
                            <doclint>${javadoc.lint}</doclint>
                        </configuration>
                    </plugin>
                    <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>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
