<?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>

    <groupId>ch.admin.bit.jeap.archivetype.jeap</groupId>
    <artifactId>process-snapshot-v2</artifactId>
    <version>2</version>
    <packaging>jar</packaging>
    <description>Archive type process-snapshot-v2 used in jEAP libraries and products</description>

    <name>${project.groupId}:${project.artifactId}</name>
    <url>https://github.com/jeap-admin-ch/jeap-archive-type-registry/tree/main</url>
    <scm>
        <url>https://github.com/jeap-admin-ch/jeap-archive-type-registry.git</url>
        <connection>scm:git:git://github.com/jeap-admin-ch/jeap-archive-type-registry.git</connection>
        <developerConnection>scm:git:ssh://github.com:jeap-admin-ch/jeap-archive-type-registry.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>

    <properties>
        <java.version>21</java.version>
        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.11.1</maven-javadoc-plugin.version>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jeap-central-publishing-maven-plugin.version>0.7.0.1</jeap-central-publishing-maven-plugin.version>
        <maven-gpg-plugin.version>3.2.5</maven-gpg-plugin.version>
        <maven-deploy-plugin.version>3.1.3</maven-deploy-plugin.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.12.0</version>
        </dependency>
        
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <testSource>${java.version}</testSource>
                    <testTarget>${java.version}</testTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultEntries>true</addDefaultEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Bundle-License>https://www.apache.org/licenses/LICENSE-2.0</Bundle-License>
                        </manifestEntries>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>additional-artifact-with-classifier</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>2</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <failOnWarnings>false</failOnWarnings>
                    <failOnError>false</failOnError>
                    <doclint>none</doclint>
                    <quiet>true</quiet>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <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>

    <profiles>
        <profile>
            <id>maven-central-publish</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <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>install</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>ch.admin.bit.jeap</groupId>
                        <artifactId>jeap-central-publishing-maven-plugin</artifactId>
                        <version>${jeap-central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <id>central-publish</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>publish</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <publishingServerId>maven-central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <skipPublishing>false</skipPublishing>
                            <waitPollingInterval>15</waitPollingInterval>
                            <ignorePublishedComponents>true</ignorePublishedComponents>
                            <deploymentName>${project.artifactId}-${project.version}</deploymentName>
                            <waitUntil>validated</waitUntil>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>${maven-deploy-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>after-publish-validation-deploy</id>
                                <phase>none</phase><!-- Re-enable after central publication -->
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                                <configuration>
                                    <deployAtEnd>true</deployAtEnd>
                                </configuration>
                            </execution>
                            <!-- The built-in execution must be disabled as it would run before the
                            central-publishing-maven-plugin. We want to validate central deployments before deploying
                             to the jEAP repository. -->
                            <execution>
                                <id>default-deploy</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

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