<?xml version="1.0"?>
<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">
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>aero.t2s</groupId>
    <artifactId>mode-s-parent</artifactId>
    <version>0.1.0</version>
    <packaging>pom</packaging>
    <name>Mode-S Parent</name>
    <description>Mode-S/ADS-B (1090Mhz) for Java</description>

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

    <scm>
        <connection>scm:git:https://github.com/terminal2/java-mode-s.git</connection>
        <developerConnection>scm:git:git@github.com:terminal2/java-mode-s.git</developerConnection>
        <url>git@github.com/terminal2/java-mode-s.git</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>

        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <version.java>${java.version}</version.java>
        <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
        <!-- disable javadoc linter for JDK8 to not fail on incomplete javadoc -->
        <additionalparam>-Xdoclint:none</additionalparam>
        <!-- Skip instrumentalization by default -->
        <jacoco.skip>true</jacoco.skip>

        <slf4j.version>1.7.25</slf4j.version>
        <log4j.version>2.13.1</log4j.version>

        <junit.version>5.4.0</junit.version>
        <hamcrest.version>2.1</hamcrest.version>
        <mockito.version>2.24.0</mockito.version>
        <cobertura.version>2.7</cobertura.version>
        <coveralls.version>3.1.0</coveralls.version>

        <javadoc.disabled>false</javadoc.disabled>
        <deploy.disabled>false</deploy.disabled>
        <source.disabled>false</source.disabled>
    </properties>

    <modules>
        <module>mode-s</module>
    </modules>

    <build>
        <defaultGoal>clean jacoco:prepare-agent package</defaultGoal>

        <pluginManagement>
            <plugins>
                <plugin>
                    <!-- cleaning -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>

                <!-- Coverage metering -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.5</version>
                    <executions>
                        <execution>
                            <id>pre-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>pre-integration-test</id>
                            <goals>
                                <goal>prepare-agent-integration</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <!-- java compiler -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- resources -->
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>

                <!-- Unit Tests -->
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                    <configuration>
                        <useSystemClassLoader>false</useSystemClassLoader>
                        <!-- Sets the VM argument line used when unit tests are run. -->
                        <!-- prevent the annoying ForkedBooter process from stealing window focus on Mac OS -->
                        <argLine>-Djava.awt.headless=true ${argLine} -XX:+StartAttachListener -Xmx1024m</argLine>
                        <systemPropertyVariables>
                            <jgiven.report.dir>${project.build.directory}/jgiven-reports</jgiven.report.dir>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>

                <!-- JavaDoc -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.1.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- Source -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.0</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>


                <!-- gitflow -->
                <plugin>
                    <groupId>com.amashchenko.maven.plugin</groupId>
                    <artifactId>gitflow-maven-plugin</artifactId>
                    <version>1.14.0</version>
                    <configuration>
                        <gitFlowConfig>
                            <productionBranch>master</productionBranch>
                            <developmentBranch>develop</developmentBranch>
                            <featureBranchPrefix>feature/</featureBranchPrefix>
                            <releaseBranchPrefix>release/</releaseBranchPrefix>
                            <hotfixBranchPrefix>hotfix/</hotfixBranchPrefix>
                            <supportBranchPrefix>support/</supportBranchPrefix>
                            <origin>origin</origin>
                        </gitFlowConfig>
                        <useSnapshotInHotfix>true</useSnapshotInHotfix>
                        <useSnapshotInRelease>true</useSnapshotInRelease>
                        <keepBranch>false</keepBranch>
                        <pushRemote>true</pushRemote>
                    </configuration>
                </plugin>

                <!-- To sign the artifacts -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.6</version>
                    <configuration>
                        <gpgArguments>
                            <arg>--batch</arg>
                            <arg>--yes</arg>
                            <arg>--pinentry-mode</arg>
                            <arg>loopback</arg>
                        </gpgArguments>
                    </configuration>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Deploy -->
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M1</version>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.8</version>
                    <configuration>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    </configuration>
                    <executions>
                        <execution>
                            <id>default-deploy</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Install -->
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>

                <!-- Enforce -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M3</version>
                    <executions>
                        <execution>
                            <id>enforce-maven</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>3.6.0</version>
                                    </requireMavenVersion>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
          Profile creating all artifacts: JARs, POMs, Sources, JavaDoc and all signatures.
        -->
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <site>
            <id>README</id>
            <url>https://github.com/toolisticon/github-actions-java</url>
        </site>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
</project>
