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

    <name>Maven Central Parent</name>
    <description>Parent POM configuration with necessary plugins for Maven Central deployments</description>
    <url>https://github.com/w-nowak/maven-central-parent/blob/main/README.md</url>
    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Wojciech Nowak</name>
            <url>https://github.com/w-nowak</url>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/w-nowak/maven-central-parent.git</connection>
        <developerConnection>scm:git:ssh://github.com:w-nowak/maven-central-parent.git</developerConnection>
        <url>https://github.com/w-nowak/maven-central-parent</url>
    </scm>
    <distributionManagement>
        <snapshotRepository>
            <id>${maven-sonatype-plugin.server-id}</id>
            <url>${maven-sonatype-plugin.nexus-server}/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>${maven-sonatype-plugin.server-id}</id>
            <url>${maven-sonatype-plugin.nexus-server}/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <groupId>io.github.w-nowak.tools</groupId>
    <artifactId>maven-central-parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <properties>
        <maven-checksum-plugin.version>1.10</maven-checksum-plugin.version>
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <maven-gpg-plugin.key-name><!-- required parameter --></maven-gpg-plugin.key-name>
        <maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
        <maven-sonatype-plugin.version>1.6.13</maven-sonatype-plugin.version>
        <maven-sonatype-plugin.auto-release>true</maven-sonatype-plugin.auto-release>
        <maven-sonatype-plugin.server-id>ossrh</maven-sonatype-plugin.server-id>
        <maven-sonatype-plugin.nexus-server>https://s01.oss.sonatype.org</maven-sonatype-plugin.nexus-server>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    </properties>

    <profiles>
        <profile>
            <id>maven-central</id>
            <build>

                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-source-plugin</artifactId>
                            <version>${maven-source-plugin.version}</version>
                            <executions>
                                <execution>
                                    <id>generate-sources</id>
                                    <phase>package</phase>
                                    <goals><goal>jar-no-fork</goal></goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>${maven-javadoc-plugin.version}</version>
                            <executions>
                                <execution>
                                    <id>generate-javadoc</id>
                                    <phase>package</phase>
                                    <goals><goal>jar</goal></goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>net.nicoulaj.maven.plugins</groupId>
                            <artifactId>checksum-maven-plugin</artifactId>
                            <version>${maven-checksum-plugin.version}</version>
                            <executions>
                                <execution>
                                    <id>generate-checksums</id>
                                    <phase>verify</phase>
                                    <goals><goal>artifacts</goal></goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <version>${maven-gpg-plugin.version}</version>
                            <executions>
                                <execution>
                                    <id>generate-gpg-signatures</id>
                                    <phase>verify</phase>
                                    <goals><goal>sign</goal></goals>
                                </execution>
                            </executions>
                            <configuration>
                                <keyname>${maven-gpg-plugin.key-name}</keyname>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.sonatype.plugins</groupId>
                            <artifactId>nexus-staging-maven-plugin</artifactId>
                            <version>${maven-sonatype-plugin.version}</version>
                            <extensions>true</extensions>
                            <configuration>
                                <serverId>${maven-sonatype-plugin.server-id}</serverId>
                                <nexusUrl>${maven-sonatype-plugin.nexus-server}</nexusUrl>
                                <autoReleaseAfterClose>${maven-sonatype-plugin.auto-release}</autoReleaseAfterClose>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>

                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>net.nicoulaj.maven.plugins</groupId>
                        <artifactId>checksum-maven-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>

</project>