<?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>de.aservo</groupId>
    <artifactId>parent-pom</artifactId>
    <version>0.0.11</version>
    <packaging>pom</packaging>

    <name>ASERVO Parent POM</name>
    <description>Maven Parent POM for Open Source Software by ASERVO.</description>
    <url>https://github.com/aservo/parent-pom</url>

    <organization>
        <name>ASERVO Software GmbH</name>
        <url>https://www.aservo.com</url>
    </organization>

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

    <scm>
        <connection>scm:git:git@github.com:aservo/parent-pom.git</connection>
        <developerConnection>scm:git:git@github.com:aservo/parent-pom.git</developerConnection>
        <url>https://github.com/aservo/parent-pom</url>
        <tag>v@{project.version}</tag>
    </scm>

    <developers>
        <developer>
            <name>Patrick Hobusch</name>
            <email>phobusch@aservo.com</email>
            <organization>ASERVO Software GmbH</organization>
            <organizationUrl>https://www.aservo.com</organizationUrl>
        </developer>
    </developers>

    <properties>
        <!-- default properties -->
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <!-- Atlassia SDK settings -->
        <downloadSources>true</downloadSources>
        <downloadJavadocs>true</downloadJavadocs>
        <allow.google.tracking>false</allow.google.tracking>
        <skipAllPrompts>true</skipAllPrompts>
        <!-- facilitate sonarcloud integration -->
        <sonar.projectKey>aservo_${project.artifactId}</sonar.projectKey>
        <sonar.organization>
            800c9135c81800959e51375f6594c91a1f757be9bbbc14d311783a4f75c501ec7807da061e787a9ea89433eb1cf2d6088b664332abd6a411ca5b44e811e97a23
        </sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <!-- default plugin versions -->
        <attach-resources.plugin.version>3.0.1</attach-resources.plugin.version>
        <deploy.plugin.version>2.8.2</deploy.plugin.version>
        <gpg.plugin.version>1.6</gpg.plugin.version>
        <jacoco.plugin.version>0.8.5</jacoco.plugin.version>
        <javax-ws-rs-api.version>2.0</javax-ws-rs-api.version>
        <nexus-staging.plugin.version>1.6.8</nexus-staging.plugin.version>
        <openapi-generator-maven-plugin.version>4.3.0</openapi-generator-maven-plugin.version>
        <surefire.plugin.version>2.22.2</surefire.plugin.version>
        <swagger.version>2.1.1</swagger.version>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus snapshot repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>

        <repository>
            <id>sonatype-nexus-staging</id>
            <name>Sonatype Nexus release staging repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swagger.version}</version>
            </dependency>

            <dependency>
                <groupId>javax.ws.rs</groupId>
                <artifactId>javax.ws.rs-api</artifactId>
                <version>${javax-ws-rs-api.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <id>defaultProfile</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>atlassian-public</id>
                    <url>https://packages.atlassian.com/mvn/maven-external</url>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                </repository>
                <repository>
                    <id>sonatype-oss-snapshot</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </snapshots>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>atlassian-public</id>
                    <url>https://packages.atlassian.com/mvn/maven-external</url>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                </pluginRepository>
                <pluginRepository>
                    <id>sonatype-oss-snapshot</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </snapshots>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                </pluginRepository>
            </pluginRepositories>
        </profile>

        <profile>
            <id>release</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <gpg.exe>gpg</gpg.exe>
                <gpg.key>${env.GPG_KEY_NAME}</gpg.key>
                <gpg.psw>${env.GPG_PASSPHRASE}</gpg.psw>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <keyname>${gpg.key}</keyname>
                            <passphrase>${gpg.psw}</passphrase>
                            <executable>${gpg.exe}</executable>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>${deploy.plugin.version}</version>
                        <configuration>
                            <!-- Deployment is already handled by nexus-staging-maven-plugin -->
                            <skip>true</skip>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging.plugin.version}</version>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <id>default-deploy</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <serverId>sonatype-nexus-staging</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>surefire</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${surefire.plugin.version}</version>
                        <configuration>
                            <skipTests>${skipUnitTests}</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>sources</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${attach-resources.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>javadoc</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${attach-resources.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jacoco</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>pre-test</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>post-test</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
