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

    <groupId>eu.europa.ec.joinup.sat</groupId>
    <artifactId>demetra-parent</artifactId>
    <version>2.2.4-RC1</version>
    <packaging>pom</packaging>

    <name>JDemetra+</name>
    <description>Seasonal Adjustment Toolkit</description>
    <url>https://github.com/jdemetra/jdemetra-core</url>

    <licenses>
        <license>
            <name>European Union Public Licence (EUPL)</name>
            <url>https://joinup.ec.europa.eu/page/eupl-text-11-12</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Philippe Charles</name>
            <email>philippe.charles@nbb.be</email>
            <organization>National Bank of Belgium</organization>
            <organizationUrl>https://www.nbb.be</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/jdemetra/jdemetra-core.git</connection>
        <developerConnection>scm:git:ssh://github.com:jdemetra/jdemetra-core.git</developerConnection>
        <url>http://github.com/jdemetra/jdemetra-core/tree/master</url>
    </scm>

    <properties>
        <sql-util.version>1.0.2</sql-util.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- annotations & processors -->
            <dependency>
                <groupId>org.checkerframework</groupId>
                <artifactId>checker-qual</artifactId>
                <version>3.25.0</version>
            </dependency>
            <dependency>
                <groupId>com.github.stephenc.jcip</groupId>
                <artifactId>jcip-annotations</artifactId>
                <version>1.0-1</version>
            </dependency>

            <!-- test libraries -->
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.9.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>3.23.1</version>
            </dependency>

            <!-- modules > -->
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-tstoolkit</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-tstoolkit2</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-tss</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-utils</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-odbc</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-jdbc</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-spreadsheet</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-sdmx</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-workspace</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>demetra-tck</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- < modules -->
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Enforce reproducible builds -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.10.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M7</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Clean binaries directory -->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>binaries</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <modules>
        <!-- core modules -->
        <module>jtstoolkit</module>
        <module>jtss</module>
        <module>utilities</module>
        <module>demetra-tck</module>
        <module>demetra-workspace</module>

        <!-- I/O modules -->
        <module>odbcprovider</module>
        <module>jdbcprovider</module>
        <module>spreadsheetprovider</module>
        <module>sdmxprovider</module>
        <module>commonprovider</module>
    </modules>

    <profiles>
        <!-- Non-deployable modules -->
        <profile>
            <id>non-deployable-modules</id>
            <activation>
                <property>
                    <name>!nonDeployableModules</name>
                </property>
            </activation>
            <modules>
                <module>jbench</module>
            </modules>
        </profile>

        <!-- Base build java8 -->
        <profile>
            <id>base-java8</id>
            <activation>
                <property>
                    <name>!skipBaseJava8</name>
                </property>
            </activation>
            <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.source>1.8</maven.compiler.source>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <useModulePath>false</useModulePath>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Base processors -->
        <profile>
            <id>base-processors</id>
            <activation>
                <property>
                    <name>!skipBaseProcessors</name>
                </property>
            </activation>
            <properties>
                <lombok.version>1.18.24</lombok.version>
                <java-service.version>1.5.1</java-service.version>
            </properties>
            <dependencyManagement>
                <dependencies>
                    <dependency>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${lombok.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.github.nbbrd.java-service-util</groupId>
                        <artifactId>java-service-annotation</artifactId>
                        <version>${java-service.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.github.nbbrd.java-service-util</groupId>
                        <artifactId>java-service-processor</artifactId>
                        <version>${java-service.version}</version>
                    </dependency>
                </dependencies>
            </dependencyManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>org.projectlombok</groupId>
                                    <artifactId>lombok</artifactId>
                                    <version>${lombok.version}</version>
                                </path>
                                <path>
                                    <groupId>com.github.nbbrd.java-service-util</groupId>
                                    <artifactId>java-service-processor</artifactId>
                                    <version>${java-service.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Enforce Java8 API -->
        <profile>
            <id>enforce-java8-api</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <properties>
                <maven.compiler.release>8</maven.compiler.release>
            </properties>
        </profile>

        <!-- Enforce dependency & Maven-central rules -->
        <profile>
            <id>enforce-dependency-rules</id>
            <activation>
                <property>
                    <name>!skipEnforceDependencyRules</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>3.1.0</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.kordamp.maven</groupId>
                                <artifactId>pomchecker-enforcer-rules</artifactId>
                                <version>1.3.0</version>
                            </dependency>
                            <dependency>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>extra-enforcer-rules</artifactId>
                                <version>1.6.1</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>enforce</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireMavenVersion>
                                            <version>3.6.0</version>
                                        </requireMavenVersion>
                                        <DependencyConvergence/>
                                        <requireReleaseDeps>
                                            <onlyWhenRelease>true</onlyWhenRelease>
                                        </requireReleaseDeps>
                                        <CheckMavenCentral
                                                implementation="org.kordamp.maven.enforcer.checker.CheckMavenCentral">
                                            <release>false</release>
                                            <strict>false</strict>
                                        </CheckMavenCentral>
                                        <enforceBytecodeVersion>
                                            <maxJdkVersion>8</maxJdkVersion>
                                            <ignoredScopes>
                                                <ignoreScope>test</ignoreScope>
                                            </ignoredScopes>
                                        </enforceBytecodeVersion>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Enforce modern API -->
        <profile>
            <id>enforce-modern-api</id>
            <activation>
                <property>
                    <name>!skipEnforceModernAPI</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.gaul</groupId>
                        <artifactId>modernizer-maven-plugin</artifactId>
                        <version>2.4.0</version>
                        <configuration>
                            <javaVersion>1.8</javaVersion>
                            <exclusionPatterns>
                                <exclusionPattern>com/google/common/base/Optional.*</exclusionPattern>
                            </exclusionPatterns>
                        </configuration>
                        <executions>
                            <execution>
                                <id>modernizer</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>modernizer</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Optional checks -->
        <profile>
            <id>optional-checks</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.8</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Base deploy -->
        <profile>
            <id>base-deploy</id>
            <build>
                <plugins>
                    <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>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <executions>
                            <execution>
                                <id>attach-empty-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludePackageNames>*</excludePackageNames>
                            <quiet>true</quiet>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.simplify4u.plugins</groupId>
                        <artifactId>sign-maven-plugin</artifactId>
                        <version>1.0.1</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Deploy SNAPSHOTS to OSSRH -->
        <profile>
            <id>snapshot-deploy</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
                </snapshotRepository>
            </distributionManagement>
            <build>
                <plugins>
                    <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://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Deploy RELEASES to OSSRH -->
        <profile>
            <id>release-deploy</id>
            <distributionManagement>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <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://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
