<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>fr.insee.trevas</groupId>
    <artifactId>trevas-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.12.0</version>
    <modules>
        <module>vtl-parser</module>
        <module>vtl-model</module>
        <module>vtl-engine</module>
        <module>vtl-jackson</module>
        <module>vtl-spark</module>
        <module>vtl-jdbc</module>
        <module>vtl-sdmx</module>
        <module>vtl-csv</module>
        <module>vtl-prov</module>
        <module>coverage</module>
    </modules>

    <name>Trevas</name>
    <description>Transformation engine and validator for statistics.</description>
    <url>https://inseefr.github.io/Trevas</url>
    <organization>
        <name>Insee</name>
        <url>http://insee.fr</url>
    </organization>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/InseeFr/Trevas.git</connection>
        <developerConnection>scm:git:https://github.com/InseeFr/Trevas.git</developerConnection>
        <url>https://github.com/InseeFr/Trevas/tree/${project.scm.tag}</url>
        <tag>master</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/InseeFr/Trevas/issues</url>
    </issueManagement>

    <ciManagement>
        <system>Gihtub</system>
        <url>https://github.com/InseeFr/Trevas/actions</url>
    </ciManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>github</id>
            <name>GitHub Packages</name>
            <url>https://maven.pkg.github.com/InseeFr/Trevas</url>
        </snapshotRepository>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com/api/publish/maven</url>
        </repository>
        <site>
            <!-- Both id and url are required for site:stage; placeholder URL for now. -->
            <id>trevas-site</id>
            <url>scp://localhost/trevas/</url>
        </site>
    </distributionManagement>

    <properties>
        <jdk.version>17</jdk.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jacoco.version>0.8.13</jacoco.version>
        <sonar.coverage.jacoco.xmlReportPaths>
            ${project.basedir}/coverage/target/site/jacoco-aggregate/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.26.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.12.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <!-- Restore the default maven final artifact name. -->
        <finalName>${project.artifactId}-${project.version}</finalName>
        <plugins>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.44.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                            <goal>apply</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <java>
                        <googleJavaFormat>
                            <version>1.27.0</version>
                        </googleJavaFormat>
                    </java>
                </configuration>
            </plugin>
            <plugin>
                <!-- Require minimum Java and Maven versions. -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>${jdk.version}</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>3.3.9</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.3</version>
                <configuration>
                    <!-- Sets the VM argument line used when unit tests are run. -->
                    <!-- Suppress UnresolvedMavenProperty. -->
                    <argLine>-Xms1g -Xmx2g @{surefireArgLine}</argLine>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <forkedProcessExitTimeoutInSeconds>180</forkedProcessExitTimeoutInSeconds>
                    <forkCount>1</forkCount>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <!-- Prepare the property pointing to the JaCoCo runtime agent which is
                         passed as VM argument when the Maven Surefire plugin is executed. -->
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- Set the name of the property containing the settings for JaCoCo
                                 runtime agent. -->
                            <propertyName>surefireArgLine</propertyName>
                            <append>true</append>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <formats>
                                <format>XML</format>
                            </formats>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.9.1.2184</version>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.0</version>
                    <configuration>
                        <release>${jdk.version}</release>
                        <testRelease>${jdk.version}</testRelease>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.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-site-plugin</artifactId>
                        <version>4.0.0-M16</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>3.6.2</version>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.8.0</version>
                        <configuration>
                            <detectJavaApiLink>false</detectJavaApiLink>
                            <doclint>none</doclint>
                            <additionalOptions>
                                <additionalOption>--ignore-source-errors</additionalOption>
                                <additionalOption>-Xdoclint:none</additionalOption>
                                <additionalOption>--release=${jdk.version}</additionalOption>
                            </additionalOptions>
                        </configuration>
                        <executions>
                            <execution>
                                <id>aggregate</id>
                                <goals>
                                    <goal>aggregate</goal>
                                </goals>
                                <phase>site</phase>
                            </execution>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.8.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.8.0</version>
                        <configuration>
                            <detectJavaApiLink>false</detectJavaApiLink>
                            <doclint>none</doclint>
                            <additionalOptions>
                                <additionalOption>--ignore-source-errors</additionalOption>
                                <additionalOption>-Xdoclint:none</additionalOption>
                                <additionalOption>--release=${jdk.version}</additionalOption>
                            </additionalOptions>
                        </configuration>
                    </plugin>
                </plugins>
            </reporting>
        </profile>
        <profile>
            <id>coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <executions>
                            <!-- Prepare the property pointing to the JaCoCo runtime agent which is
                                 passed as VM argument when the Maven Surefire plugin is executed. -->
                            <execution>
                                <id>pre-unit-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <!-- Set the name of the property containing the settings for JaCoCo
                                         runtime agent. -->
                                    <propertyName>surefireArgLine</propertyName>
                                    <append>true</append>
                                </configuration>
                            </execution>
                            <execution>
                                <id>post-unit-test</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <formats>
                                        <format>XML</format>
                                    </formats>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <developers>
        <developer>
            <name>Franck Cotton</name>
            <email>franck@making-sense.info</email>
        </developer>
        <developer>
            <name>Hadrien Kohl</name>
            <email>hadrien.kohl@gmail.com</email>
        </developer>
        <developer>
            <name>Nicolas Laval</name>
            <email>nicolas.laval@making-sense.info</email>
        </developer>
    </developers>

</project>