<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>info.freelibrary</groupId>
  <artifactId>freelib-build-tools</artifactId>
  <version>12.0.2</version>
  <packaging>pom</packaging>
  <name>FreeLibrary Build Tools</name>
  <description>Build tools for FreeLibrary projects.</description>
  <url>https://github.com/ksclarke/freelib-build-tools</url>
  <organization>
    <name>FreeLibrary</name>
    <url>http://projects.freelibrary.info</url>
  </organization>
  <licenses>
    <license>
      <name>Mozilla Public License 2.0 (MPL-2.0)</name>
      <url>https://opensource.org/licenses/MPL-2.0</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Kevin S. Clarke</name>
      <email>ksclarke@gmail.com</email>
      <url>http://kevinclarke.info</url>
      <roles>
        <role>developer</role>
      </roles>
      <timezone>America/New_York</timezone>
    </developer>
  </developers>
  <modules>
    <module>freelib-resources</module>
    <module>freelib-parent</module>
  </modules>
  <scm>
    <connection>scm:git:git@github.com:ksclarke/freelib-build-tools.git</connection>
    <developerConnection>scm:git:git@github.com:ksclarke/freelib-build-tools.git</developerConnection>
    <url>git@github.com:ksclarke/freelib-build-tools.git</url>
  </scm>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/ksclarke/freelib-build-tools/issues</url>
  </issueManagement>
  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
  <properties>
    <flatten.plugin.version>1.6.0</flatten.plugin.version>
    <jacoco.dataFile>${project.build.directory}/jacoco.exec</jacoco.dataFile>
    <autorelease.artifact>false</autorelease.artifact>
    <maven.site.skip>true</maven.site.skip>
    <pmd.version>7.7.0</pmd.version>
    <formatter.plugin.version>2.24.1</formatter.plugin.version>
    <maven.install.plugin.version>3.1.3</maven.install.plugin.version>
    <maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
    <maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.site.deploy.skip>true</maven.site.deploy.skip>
    <maven.site.plugin.version>3.21.0</maven.site.plugin.version>
    <maven.failsafe.plugin.version>3.5.2</maven.failsafe.plugin.version>
    <maven.test.skip>true</maven.test.skip>
    <maven.jar.plugin.version>3.4.2</maven.jar.plugin.version>
    <pmd.plugin.version>3.26.0</pmd.plugin.version>
    <jacoco.maven.plugin.version>0.8.12</jacoco.maven.plugin.version>
    <maven.checkstyle.version>3.6.0</maven.checkstyle.version>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <revision>0.0.0-SNAPSHOT</revision>
    <checkstyle.version>10.20.1</checkstyle.version>
    <maven.dependency.plugin.version>3.8.1</maven.dependency.plugin.version>
    <maven.surefire.plugin.version>3.5.2</maven.surefire.plugin.version>
    <maven.enforcer.plugin.version>3.5.0</maven.enforcer.plugin.version>
  </properties>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>${flatten.plugin.version}</version>
          <executions>
            <execution>
              <id>flatten</id>
              <phase>process-resources</phase>
              <goals>
                <goal>flatten</goal>
              </goals>
            </execution>
            <execution>
              <id>flatten-clean</id>
              <phase>clean</phase>
              <goals>
                <goal>clean</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <updatePomFile>true</updatePomFile>
            <flattenMode>resolveCiFriendliesOnly</flattenMode>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven.dependency.plugin.version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven.surefire.plugin.version}</version>
          <configuration>
            <excludes>
              <exclude>**/*IT.java</exclude>
              <exclude>**/*FT.java</exclude>
              <exclude>**/*FfOnT.java</exclude>
              <exclude>**/*FfOffT.java</exclude>
              <exclude>**/*IntegrationTest.java</exclude>
              <exclude>**/*FunctionalTest.java</exclude>
              <exclude>**/*FeatureFlagTest.java</exclude>
            </excludes>
            <forkCount>3</forkCount>
            <reuseForks>true</reuseForks>
            <argLine>-XX:MaxMetaspaceSize=512m ${jacoco.agent.arg}</argLine>
            <systemPropertyVariables>
              <http.agent>Maven</http.agent>
            </systemPropertyVariables>
            <trimStackTrace>false</trimStackTrace>
            <skipTests>${maven.test.skip}</skipTests>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven.failsafe.plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <argLine>-XX:MaxMetaspaceSize=128m ${jacoco.agent.arg}</argLine>
            <includes>
              <include>**/*IT.java</include>
              <include>**/*FT.java</include>
              <include>**/*FfOnT.java</include>
              <include>**/*FfOffT.java</include>
              <include>**/*IntegrationTest.java</include>
              <include>**/*FunctionalTest.java</include>
              <include>**/*FeatureFlagTest.java</include>
            </includes>
            <excludes>
              <exclude>**/*.xml</exclude>
              <exclude>**/*.md</exclude>
              <exclude>**/*Test.java</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven.enforcer.plugin.version}</version>
          <executions>
            <execution>
              <id>enforce-no-snapshots</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <failFast>true</failFast>
                <rules>
                  <requireReleaseDeps>
                    <onlyWhenRelease>false</onlyWhenRelease>
                    <failWhenParentIsSnapshot>false</failWhenParentIsSnapshot>
                    <message>Sorry, dependency snapshots are not allowed! To temporarily ignore this
                      restriction add the following to the command line: -Denforcer.skip=true</message>
                  </requireReleaseDeps>
                </rules>
                <fail>true</fail>
              </configuration>
            </execution>
            <execution>
              <id>enforce-java</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireJavaVersion>
                    <version>[17,)</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
            <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.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco.maven.plugin.version}</version>
          <executions>
            <execution>
              <id>default-prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
              <configuration>
                <destFile>${jacoco.dataFile}</destFile>
                <propertyName>jacoco.agent.arg</propertyName>
                <append>true</append>
                <excludes>
                  <exclude>src/test/java/**/*</exclude>
                </excludes>
              </configuration>
            </execution>
            <execution>
              <id>default-prepare-agent-integration</id>
              <goals>
                <goal>prepare-agent-integration</goal>
              </goals>
              <configuration>
                <destFile>${jacoco.dataFile}</destFile>
                <propertyName>jacoco.agent.arg</propertyName>
                <append>true</append>
                <excludes>
                  <exclude>src/test/java/**/*</exclude>
                </excludes>
              </configuration>
            </execution>
            <execution>
              <id>default-report</id>
              <phase>verify</phase>
              <goals>
                <goal>report</goal>
              </goals>
              <configuration>
                <dataFile>${jacoco.dataFile}</dataFile>
                <excludes>
                  <exclude>src/test/java/**/*</exclude>
                </excludes>
              </configuration>
            </execution>
            <execution>
              <id>integration-report</id>
              <phase>verify</phase>
              <goals>
                <goal>report-integration</goal>
              </goals>
              <configuration>
                <dataFile>${jacoco.dataFile}</dataFile>
                <excludes>
                  <exclude>src/test/java/**/*</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven.install.plugin.version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven.resources.plugin.version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven.compiler.plugin.version}</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven.jar.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>net.revelc.code.formatter</groupId>
          <artifactId>formatter-maven-plugin</artifactId>
          <version>${formatter.plugin.version}</version>
          <executions>
            <execution>
              <phase>prepare-package</phase>
              <goals>
                <goal>format</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <configFile>src/main/tools/eclipse/freelibrary-formatter.xml</configFile>
            <configJsFile>src/main/tools/eclipse/freelibrary-javascript-formatter.xml</configJsFile>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>${pmd.plugin.version}</version>
          <executions>
            <execution>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-core</artifactId>
              <version>${pmd.version}</version>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.pmd</groupId>
              <artifactId>pmd-java</artifactId>
              <version>${pmd.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <linkXRef>false</linkXRef>
            <analysisCache>true</analysisCache>
            <analysisCacheLocation>target/pmd/pmd.cache</analysisCacheLocation>
            <printFailingErrors>true</printFailingErrors>
            <rulesets>
              <ruleset>src/main/tools/pmd/ruleset.xml</ruleset>
            </rulesets>
            <targetJdk>${maven.compiler.source}</targetJdk>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven.checkstyle.version}</version>
          <executions>
            <execution>
              <id>checkstyle</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <logViolationsToConsole>true</logViolationsToConsole>
            <violationSeverity>warning</violationSeverity>
            <failOnViolation>true</failOnViolation>
            <failsOnError>true</failsOnError>
            <consoleOutput>false</consoleOutput>
            <includeTestSourceDirectory>true</includeTestSourceDirectory>
            <includeTestResources>true</includeTestResources>
            <includeResources>true</includeResources>
            <suppressionsLocation>src/main/tools/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
            <configLocation>src/main/tools/checkstyle/checkstyle.xml</configLocation>
            <excludeGeneratedSources>true</excludeGeneratedSources>
            <resourceExcludes>target/**,**/generated/**,**/META-INF/**</resourceExcludes>
            <excludes>target/**,**/generated/**,**/MediaType.java,**/MessageCodes.java</excludes>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven.site.plugin.version}</version>
          <configuration>
            <skip>true</skip>
            <skipDeploy>true</skipDeploy>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>code-analysis</id>
      <activation>
        <file>
          <exists>freelib-resources</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-pmd-plugin</artifactId>
            <configuration>
              <rulesets>
                <ruleset>freelib-resources/src/main/resources/pmd/ruleset.xml</ruleset>
              </rulesets>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <configuration>
              <suppressionsLocation>freelib-resources/src/main/resources/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
              <configLocation>freelib-resources/src/main/resources/checkstyle/checkstyle.xml</configLocation>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <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>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <signer>bc</signer>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${nexus.staging.plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>${autorelease.artifact}</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <properties>
        <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.11.1</maven.javadoc.plugin.version>
        <gpg.plugin.version>3.2.7</gpg.plugin.version>
        <nexus.staging.plugin.version>1.7.0</nexus.staging.plugin.version>
      </properties>
    </profile>
  </profiles>
</project>
