<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: 2026 Sergey Sokolov <mohterbaord@gmail.com> -->
<!-- SPDX-License-Identifier: Apache-2.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">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>dev.mohterbaord</groupId>
    <artifactId>maven-parent</artifactId>
    <version>7.0</version>
  </parent>

  <artifactId>java-library-parent</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>

  <name>Java Library Parent</name>
  <description>A parent POM for Java libraries</description>
  <url>https://codeberg.org/mohterbaord/java-library-parent</url>
  <organization>
    <name>Sergey Sokolov</name>
  </organization>
  <inceptionYear>2026</inceptionYear>

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

  <developers>
    <developer>
      <id>mohterbaord</id>
      <name>Sergey Sokolov</name>
      <email>mohterbaord@gmail.com</email>
      <url>https://www.mohterbaord.dev</url>
      <roles>
        <role>Project lead</role>
        <role>Developer</role>
        <role>Maintainer</role>
      </roles>
    </developer>
  </developers>

  <scm>
    <url>https://codeberg.org/mohterbaord/java-library-parent</url>
    <connection>scm:git:https://codeberg.org/mohterbaord/java-library-parent.git</connection>
    <developerConnection>scm:git:ssh://git@codeberg.org/mohterbaord/java-library-parent.git</developerConnection>
    <tag>1.0</tag>
  </scm>

  <properties>

    <!-- Path to license header; used by Spotless to check/update Java sources
         license headers. -->
    <resource.license-header-java>${project.basedir}/rc/license-header-java</resource.license-header-java>

  </properties>

  <profiles>

    <!-- NOTE: profiles starting with `java-library` are provided and should be
               used in children -->

    <profile>
      <id>java-library:build</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library:quality</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>

              <execution>
                <id>jacoco-prepare-agent</id>
                <phase>initialize</phase>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>

              <execution>
                <id>jacoco-report</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>

              <execution>
                <id>jacoco-check</id>
                <phase>verify</phase>
                <goals>
                  <goal>check</goal>
                </goals>
                <configuration>
                  <rules>
                    <rule>
                      <element>PACKAGE</element>
                      <limits>
                        <limit>
                          <counter>LINE</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>90%</minimum>
                        </limit>
                      </limits>
                    </rule>
                  </rules>
                </configuration>
              </execution>

            </executions>
          </plugin>

          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>spotless-check-java</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <configuration>
                  <java>
                    <includes>
                      <include>src/main/java/**/*.java</include>
                    </includes>
                    <removeUnusedImports />
                    <forbidWildcardImports />
                    <licenseHeader>
                      <file>${resource.license-header-java}</file>
                    </licenseHeader>
                  </java>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library:versions</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce-maven</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireMavenVersion>
                      <version>3.6.3</version>
                    </requireMavenVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <configuration>
              <includeParent>false</includeParent>
              <ruleSet>
                <ignoreVersion>
                  <type>regex</type>
                  <version>.+-(SNAPSHOT|M\d)</version>
                </ignoreVersion>
                <ignoreVersion>
                  <type>regex</type>
                  <version>.+-(alpha|beta).*</version>
                </ignoreVersion>
              </ruleSet>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library:license</id>
      <properties>
        <skipTests>true</skipTests>
        <license.licenseName>apache_v2</license.licenseName>
      </properties>
      <build>
        <plugins>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>upsert-license-file</id>
                <goals>
                  <goal>update-project-license</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>update-license-headers-java</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>apply</goal>
                </goals>
                <configuration>
                  <java>
                    <includes>
                      <include>src/main/java/**/*.java</include>
                    </includes>
                    <licenseHeader>
                      <file>${resource.license-header-java}</file>
                    </licenseHeader>
                  </java>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library:release</id>
      <properties>
        <keynameProfile>keyname-general</keynameProfile>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
              <autoVersionSubmodules>true</autoVersionSubmodules>
              <tagNameFormat>@{version}</tagNameFormat>
              <releaseProfiles>${keynameProfile},java-library:build,java-library:quality,java-library:publish</releaseProfiles>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library:publish</id>
      <properties>
        <publishingServerId>java-library-usertoken</publishingServerId>
      </properties>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <bestPractices>true</bestPractices>
                  <defaultKeyring>false</defaultKeyring>
                  <keyname>${gpg.keyname}</keyname>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>${publishingServerId}</publishingServerId>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>

    <!-- NOTE: profiles starting with `java-library-parent` are only used in the
               POM's own build lifecycle and then should not be used in children -->

    <profile>
      <id>java-library-parent:versions</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>3.6.2</version>
            <executions>
              <execution>
                <id>enforce-maven</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireMavenVersion>
                      <version>3.6.3</version>
                    </requireMavenVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>2.20.1</version>
            <configuration>
              <ruleSet>
                <ignoreVersion>
                  <type>regex</type>
                  <version>.+-(SNAPSHOT|M\d)</version>
                </ignoreVersion>
                <ignoreVersion>
                  <type>regex</type>
                  <version>.+-(alpha|beta).*</version>
                </ignoreVersion>
                <rules>
                  <rule>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <ignoreVersion>
                      <type>regex</type>
                      <version>.*</version>
                    </ignoreVersion>
                  </rule>
                  <rule>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <ignoreVersion>
                      <type>regex</type>
                      <version>.*</version>
                    </ignoreVersion>
                  </rule>
                </rules>
              </ruleSet>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library-parent:license</id>
      <properties>
        <skipTests>true</skipTests>
        <license.licenseName>apache_v2</license.licenseName>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <version>2.7.1</version>
            <executions>
              <execution>
                <id>upsert-license-file</id>
                <goals>
                  <goal>update-project-license</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library-parent:release</id>
      <properties>
        <keynameProfile>keyname-general</keynameProfile>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
              <autoVersionSubmodules>true</autoVersionSubmodules>
              <tagNameFormat>@{version}</tagNameFormat>
              <releaseProfiles>${keynameProfile},java-library-parent:publish</releaseProfiles>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>java-library-parent:publish</id>
      <properties>
        <publishingServerId>java-library-parent-usertoken</publishingServerId>
      </properties>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.8</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <bestPractices>true</bestPractices>
                  <defaultKeyring>false</defaultKeyring>
                  <keyname>${gpg.keyname}</keyname>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.10.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>${publishingServerId}</publishingServerId>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>

  </profiles>
</project>
