<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>net.laprun.sustainability</groupId>
  <artifactId>if-manifest-java</artifactId>
  <version>0.0.2</version>

  <name>if-manifest-java</name>
  <description>Manipulate Green Software Foundation's Impact Framework manifests in Java</description>
  <url>https://github.com/metacosm/if-manifest-java</url>
  <inceptionYear>2024</inceptionYear>

  <licenses>
    <license>
      <name>Apache 2 License</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Christophe Laprun</name>
      <email>metacosm@gmail.com</email>
      <roles>
        <role>author</role>
      </roles>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/metacosm/if-manifest-java.git</connection>
    <developerConnection>scm:git:git@github.com/metacosm/if-manifest-java.git</developerConnection>
    <tag>0.0.2</tag>
    <url>https://github.com/metacosm/if-manifest-java/tree/main</url>
  </scm>

  <properties>
    <maven.compiler.release>21</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <compiler-plugin.version>3.13.0</compiler-plugin.version>
    <surefire-plugin.version>3.5.2</surefire-plugin.version>
    <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
    <buildnumber-plugin.version>3.2.1</buildnumber-plugin.version>
    <formatter-plugin.version>2.24.1</formatter-plugin.version>
    <impsort-plugin.version>1.12.0</impsort-plugin.version>
    <maven-javadoc-plugin.version>3.11.1</maven-javadoc-plugin.version>
    <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
    <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
    <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
    <central-maven-publishing-plugin.version>0.6.0</central-maven-publishing-plugin.version>
    <maven-release-plugin.version>3.1.1</maven-release-plugin.version>
    <maven-deploy-plugin.version>3.1.3</maven-deploy-plugin.version>
    <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
    <spotless.version>2.43.0</spotless.version>

    <jackson.version>2.18.2</jackson.version>
    <junit.version>5.11.3</junit.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.fasterxml.jackson</groupId>
        <artifactId>jackson-bom</artifactId>
        <version>${jackson.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${compiler-plugin.version}</version>
        <configuration>
          <parameters>true</parameters>
        </configuration>
      </plugin>
      <!-- Set properties containing the scm revision -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>${buildnumber-plugin.version}</version>
        <executions>
          <execution>
            <id>get-scm-revision</id>
            <goals>
              <goal>create</goal>
            </goals>
            <phase>initialize</phase>
            <configuration>
              <doCheck>false</doCheck>
              <doUpdate>false</doUpdate>
              <revisionOnScmFailure>UNKNOWN</revisionOnScmFailure>
              <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <configuration>
          <reportFormat>plain</reportFormat>
          <consoleOutputReporter>
            <disable>true</disable>
          </consoleOutputReporter>
          <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
            <theme>UNICODE</theme>
          </statelessTestsetInfoReporter>
          <systemPropertyVariables>
            <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
            <maven.home>${maven.home}</maven.home>
          </systemPropertyVariables>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>me.fabriciorby</groupId>
            <artifactId>maven-surefire-junit5-tree-reporter</artifactId>
            <version>1.4.0</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${surefire-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless.version}</version>
        <configuration>
          <pom>
            <includes>
              <include>pom.xml</include>
              <include>./**/pom.xml</include>
            </includes>
            <sortPom>
              <expandEmptyElements>false</expandEmptyElements>
            </sortPom>
          </pom>
          <java>
            <eclipse>
              <file>contributing/eclipse-google-style.xml</file>
            </eclipse>
            <importOrder>
              <file>contributing/eclipse.importorder</file>
            </importOrder>
            <removeUnusedImports/>
          </java>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>apply</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>${maven-jar-plugin.version}</version>
            <configuration>
              <archive>
                <index>true</index>
                <manifest>
                  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                </manifest>
                <manifestEntries>
                  <Implementation-URL>${project.url}</Implementation-URL>
                  <Java-Version>${java.version}</Java-Version>
                  <Java-Vendor>${java.vendor}</Java-Vendor>
                  <Os-Name>${os.name}</Os-Name>
                  <Os-Arch>${os.arch}</Os-Arch>
                  <Os-Version>${os.version}</Os-Version>
                  <Scm-Url>${project.scm.url}</Scm-Url>
                  <Scm-Connection>${project.scm.connection}</Scm-Connection>
                  <Scm-Revision>${buildNumber}</Scm-Revision>
                </manifestEntries>
              </archive>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <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>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</version>
            <configuration>
              <archive>
                <index>true</index>
                <manifest>
                  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                  <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                </manifest>
                <manifestEntries>
                  <Implementation-URL>${project.url}</Implementation-URL>
                  <Java-Version>${java.version}</Java-Version>
                  <Java-Vendor>${java.vendor}</Java-Vendor>
                  <Os-Name>${os.name}</Os-Name>
                  <Os-Arch>${os.arch}</Os-Arch>
                  <Os-Version>${os.version}</Os-Version>
                  <Scm-Url>${project.scm.url}</Scm-Url>
                  <Scm-Connection>${project.scm.connection}</Scm-Connection>
                  <Scm-Revision>${buildNumber}</Scm-Revision>
                </manifestEntries>
              </archive>
            </configuration>
            <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-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>${maven-release-plugin.version}</version>
            <configuration>
              <preparationGoals>clean install</preparationGoals>
              <autoVersionSubmodules>true</autoVersionSubmodules>
              <useReleaseProfile>false</useReleaseProfile>
              <releaseProfiles>release</releaseProfiles>
              <goals>deploy</goals>
              <tagNameFormat>@{project.version}</tagNameFormat>
              <pushChanges>false</pushChanges>
              <localCheckout>true</localCheckout>
              <remoteTagging>false</remoteTagging>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>${central-maven-publishing-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <autoPublish>true</autoPublish>
              <tokenAuth>true</tokenAuth>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
