<?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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.axual.helper</groupId>
    <artifactId>axual-helper</artifactId>
    <name>Axual Client Helper</name>
    <version>1.0.0-M2</version>

    <packaging>pom</packaging>

    <licenses>
        <license>
            <name>Apache 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <organization>
        <name>Axual B.V.</name>
        <url>https://axual.com/</url>
    </organization>

    <description>
        Java Helper library that enables interaction with the Axual platform.
    </description>

    <url>https://axual.com/</url>
    <inceptionYear>2022</inceptionYear>

    <scm>
        <developerConnection>scm:git:git@gitlab.com:axual/public/java-helper.git</developerConnection>
        <connection>scm:git:git@gitlab.com:axual/public/java-helper.git</connection>
        <url>ssh://git@gitlab.com:axual/public/java-helper.git</url>
        <tag>HEAD</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>snapshots</id>
            <url>${axual.maven.repository.url.snapshots}</url>
        </snapshotRepository>
        <repository>
            <id>releases</id>
            <url>${axual.maven.repository.url.releases}</url>
        </repository>
    </distributionManagement>

    <developers>
        <developer>
            <name>Team Altair</name>
            <email>altair@axual.com</email>
            <organization>Axual B.V.</organization>
            <organizationUrl>https://axual.com</organizationUrl>
        </developer>
    </developers>

    <repositories>
        <repository>
            <id>confluent</id>
            <url>https://packages.confluent.io/maven/</url>
        </repository>
    </repositories>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.coverage.jacoco.xmlReportPaths>
            ${project.basedir}/../report-aggregate/target/site/jacoco/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>

        <!-- Staging plugin properties -->
        <staging.progress.timeout.minutes>30</staging.progress.timeout.minutes>

        <!-- License -->
        <license.licenseName>apache_v2</license.licenseName>
        <license-maven-plugin.version>2.0.0</license-maven-plugin.version>
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
    </properties>

    <modules>
        <module>parent</module>
        <module>report-aggregate</module>
        <module>axual-generic</module>
        <module>axual-kafka</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license-maven-plugin.version}</version>
                <configuration>
                    <outputDirectory>${project.basedir}</outputDirectory>
                    <thirdPartyFilename>NOTICE.txt</thirdPartyFilename>
                    <verbose>false</verbose>
                    <processStartTag>========================LICENSE_START=================================</processStartTag>
                    <processEndTag>=========================LICENSE_END==================================</processEndTag>
                    <includes>
                        <includes>**/*.java</includes>
                    </includes>
                    <excludedGroups>
                        io.axual
                    </excludedGroups>
                </configuration>
            </plugin>

            <!-- Needed to release to maven central -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-staging-maven-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>releases</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    <stagingProgressTimeoutMinutes>${staging.progress.timeout.minutes}</stagingProgressTimeoutMinutes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>

        <profile>
            <id>sign-artifacts</id>
            <build>
                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <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>
                                    <!-- This is necessary for gpg to not try to use the pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <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>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>

            </build>
        </profile>

    </profiles>
</project>