<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.5.14</version>
        <relativePath/>
    </parent>

    <groupId>io.github.alaugks</groupId>
    <artifactId>spring-messagesource-xliff</artifactId>
    <version>3.1.0</version>
    <packaging>jar</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>Provides a XLIFF MessageSource for Spring</description>
    <url>https://github.com/alaugks/spring-messagesource-xliff</url>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>André Laugks</name>
            <email>alaugks@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/alaugks/spring-messagesource-xliff</connection>
        <developerConnection>scm:git:https://github.com/alaugks/spring-messagesource-xliff</developerConnection>
        <url>https://github.com/alaugks/spring-messagesource-xliff</url>
    </scm>

    <properties>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${maven.compiler.release}</maven.compiler.target>
        <jacoco-maven-plugin.version>0.8.14</jacoco-maven-plugin.version>
        <maven-release-plugin.version>3.3.1</maven-release-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.10.0</central-publishing-maven-plugin.version>
    </properties>

    <repositories>
        <repository>
            <id>central-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>io.github.alaugks</groupId>
            <artifactId>spring-messagesource-catalog</artifactId>
            <version>0.6.0</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--                            DEPLOY LOCAl                                -->
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--  mvn -U -B deploy -P local -->
        <profile>
            <id>local</id>
            <distributionManagement>
                <repository>
                    <id>central</id>
                    <url>file:~/.m2/</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <additionalOptions>
                                <additionalOption>-Xdoclint:none</additionalOption>
                            </additionalOptions>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--                            DEPLOY OSSRH                                -->
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--  mvn -U -B deploy -P release -->
        <profile>
            <id>release</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <artifactId>maven-release-plugin</artifactId>
                            <version>${maven-release-plugin.version}</version>
                            <configuration>
                                <tagNameFormat>@{project.version}</tagNameFormat>
                            </configuration>
                        </plugin>
                        <plugin>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <version>${maven-gpg-plugin.version}</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>
                        <plugin>
                            <groupId>org.sonatype.central</groupId>
                            <artifactId>central-publishing-maven-plugin</artifactId>
                            <version>${central-publishing-maven-plugin.version}</version>
                            <extensions>true</extensions>
                            <configuration>
                                <publishingServerId>central</publishingServerId>
                                <autoPublish>true</autoPublish>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <additionalOptions>
                                <additionalOption>-Xdoclint:none</additionalOption>
                            </additionalOptions>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--                            TEST COVERAGE                               -->
        <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--  mvn test -P test-coverage -->
        <profile>
            <id>test-coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>before-unit-test-execution</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <destFile>${project.build.directory}/jacoco-output/jacoco-unit-tests.exec</destFile>
                                    <propertyName>surefire.jacoco.args</propertyName>
                                </configuration>
                            </execution>
                            <execution>
                                <id>after-unit-test-execution</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/jacoco-output/jacoco-unit-tests.exec</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>before-integration-test-execution</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <destFile>${project.build.directory}/jacoco-output/jacoco-integration-tests.exec</destFile>
                                    <propertyName>failsafe.jacoco.args</propertyName>
                                </configuration>
                            </execution>
                            <execution>
                                <id>after-integration-test-execution</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/jacoco-output/jacoco-integration-tests.exec</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-integration-test-coverage-report</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>merge-unit-and-integration</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>merge</goal>
                                </goals>
                                <configuration>
                                    <fileSets>
                                        <fileSet>
                                            <directory>${project.build.directory}/jacoco-output/</directory>
                                            <includes>
                                                <include>*.exec</include>
                                            </includes>
                                        </fileSet>
                                    </fileSets>
                                    <destFile>${project.build.directory}/jacoco-output/merged.exec</destFile>
                                </configuration>
                            </execution>
                            <execution>
                                <id>create-merged-report</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <dataFile>${project.build.directory}/jacoco-output/merged.exec</dataFile>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco-merged-test-coverage-report</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>check</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <rule>
                                            <element>CLASS</element>
                                            <excludes>
                                                <exclude>*Test</exclude>
                                                <exclude>*IT</exclude>
                                            </excludes>
                                            <limits>
                                                <limit>
                                                    <counter>LINE</counter>
                                                    <value>COVEREDRATIO</value>
                                                    <minimum>100%</minimum>
                                                </limit>
                                            </limits>
                                        </rule>
                                    </rules>
                                    <dataFile>${project.build.directory}/jacoco-output/merged.exec</dataFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <configuration>
                            <argLine>${surefire.jacoco.args}</argLine>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${maven-failsafe-plugin.version}</version>
                        <configuration>
                            <argLine>${failsafe.jacoco.args}</argLine>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>
