<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>

    <url>https://github.com/jeap-admin-ch/jeap-license-template</url>
    <scm>
        <url>https://github.com/jeap-admin-ch/jeap-license-template</url>
        <connection>scm:git:git://github.com/jeap-admin-ch/jeap-license-template.git</connection>
        <developerConnection>scm:git:ssh://github.com:jeap-admin-ch/jeap-license-template.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <name>BIT</name>
            <email>jeap-community@bit.admin.ch</email>
            <organization>Federal Office of Information Technology, Systems and Telecommunication FOITT</organization>
            <organizationUrl>https://www.bit.admin.ch/</organizationUrl>
        </developer>
    </developers>

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

    <groupId>ch.admin.bit.jeap</groupId>
    <artifactId>jeap-license-template</artifactId>
    <version>1.0.3</version>
    <name>jeap-license-template</name>
    <description>
        Third-party license list file template for the Maven License Plugin
    </description>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
    </properties>

    <build>
        <finalName>${project.artifactId}</finalName>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Bundle-License>https://www.apache.org/licenses/LICENSE-2.0</Bundle-License>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Test license list template in build -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>2.4.0</version>
                <executions>
                    <execution>
                        <id>add-third-party</id>
                        <goals>
                            <goal>add-third-party</goal>
                        </goals>
                        <configuration>
                            <fileTemplate>${project.basedir}/src/main/resources/ch/admin/bit/jeap/third-party.md.ftl</fileTemplate>
                            <outputDirectory>${project.basedir}</outputDirectory>
                            <thirdPartyFilename>THIRD-PARTY-LICENSES.md</thirdPartyFilename>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>maven-central-publish</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <properties>
                <!-- The jeap-central-publishing-maven-plugin will handle deployment to maven central, skip the deploy plugin -->
                <maven.deploy.skip>true</maven.deploy.skip>
                <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <gpgArguments>
                                <!-- Note: These arguments are required for gpg 2.1+ -->
                                <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>
                    <plugin>
                        <groupId>ch.admin.bit.jeap</groupId>
                        <artifactId>jeap-central-publishing-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>publish</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <publishingServerId>maven-central</publishingServerId>
                            <autoPublish>${maven-central-autopublish}</autoPublish>
                            <skipPublishing>false</skipPublishing>
                            <waitPollingInterval>15</waitPollingInterval>
                            <ignorePublishedComponents>true</ignorePublishedComponents>
                            <deploymentName>${project.name}</deploymentName>
                            <waitUntil>${maven-central-wait-until}</waitUntil>
                            <waitMaxTime>2700</waitMaxTime>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <repository>
            <id>${releaseRepositoryId}</id>
            <name>${releaseRepositoryName}</name>
            <!--suppress UnresolvedMavenProperty -->
            <url>${releaseRepositoryUrl}</url>
        </repository>
        <snapshotRepository>
            <id>${snapshotRepositoryId}</id>
            <name>${snapshotRepositoryName}</name>
            <!--suppress UnresolvedMavenProperty -->
            <url>${snapshotRepositoryUrl}</url>
        </snapshotRepository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>maven-public</id>
            <name>Maven Public Group</name>
            <url>https://repo.bit.admin.ch/repository/maven-public/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>maven-public</id>
            <name>Maven Public Group</name>
            <url>https://repo.bit.admin.ch/repository/maven-public/</url>
        </pluginRepository>
    </pluginRepositories>

</project>
