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

  <groupId>org.finos.fluxnova</groupId>
  <artifactId>fluxnova-release-parent</artifactId>
  <version>2.0.0</version>
  <packaging>pom</packaging>
  <name>fluxnova - Release Parent Pom</name>

  <description>
    This pom defines the required plugins and profiles to allow a fluxnova release build.
    Inherit this pom when you want to release your project into the maven central.
  </description>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- Avoid the message "[WARNING] Using platform encoding (UTF-8 actually) ... also for the failsafe plugin -->
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- we use java 21 for our projects -->
    <version.java>21</version.java>
    <version.ejb>3.1</version.ejb>

    <skip.camunda.release>false</skip.camunda.release>
    <skip.central.release>false</skip.central.release>
    <gpg.useagent>true</gpg.useagent>

    <plugin.version.clean>2.6.1</plugin.version.clean>
    <plugin.version.source>3.3.1</plugin.version.source>
    <plugin.version.compiler>3.14.0</plugin.version.compiler>
    <plugin.version.jar>2.6</plugin.version.jar>
    <plugin.version.javadoc>3.10.0</plugin.version.javadoc>
    <plugin.version.maven-bundle>5.1.9</plugin.version.maven-bundle>


    <plugin.version.deploy>3.1.4</plugin.version.deploy>
    <plugin.version.assembly>2.6</plugin.version.assembly>
    <plugin.version.ejb>2.4</plugin.version.ejb>
    <plugin.version.war>2.4</plugin.version.war>
    <plugin.version.ear>2.10.1</plugin.version.ear>
    <plugin.version.rar>2.4</plugin.version.rar>
    <plugin.version.gpg>3.2.7</plugin.version.gpg>
    <plugin.version.release>3.3.1</plugin.version.release>
    <plugin.version.publish>0.7.0</plugin.version.publish>

    <!-- properties required for publishing to maven central-->
    <gpg.executable>gpg</gpg.executable>
    <publish.server.id>ossrh</publish.server.id>
    <release.goals>install org.sonatype.central:central-publishing-maven-plugin:0.7.0:publish</release.goals>
    <skip.source.attach>false</skip.source.attach>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${plugin.version.clean}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${plugin.version.compiler}</version>
          <configuration>
            <source>${version.java}</source>
            <target>${version.java}</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${plugin.version.jar}</version>
          <configuration>
            <useDefaultManifestFile>true</useDefaultManifestFile>
            <archive>
              <!-- explicitly specify manifestFile because otherwise it overrides the generated one from bundle-plugin -->
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>${plugin.version.war}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-ejb-plugin</artifactId>
          <version>${plugin.version.ejb}</version>
          <configuration>
            <ejbVersion>${version.ejb}</ejbVersion>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-rar-plugin</artifactId>
          <version>${plugin.version.rar}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-ear-plugin</artifactId>
          <version>${plugin.version.ear}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>${plugin.version.assembly}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${plugin.version.release}</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <releaseProfiles>release</releaseProfiles>
            <goals>${release.goals}</goals>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>${plugin.version.publish}</version>
          <extensions>true</extensions>
          <configuration>
            <publishingServerId>${publish.server.id}</publishingServerId>
            <!-- TODO: its set to false to manually validate the artifacts before publishing, set it to true once successfully tested with all dependent projects-->
            <autoPublish>false</autoPublish>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${plugin.version.deploy}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${plugin.version.source}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${plugin.version.javadoc}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${plugin.version.gpg}</version>
          <configuration>
            <useAgent>false</useAgent>
            <gpgArguments>
              <arg>--digest-algo=SHA512</arg>
            </gpgArguments>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>${plugin.version.maven-bundle}</version>
          <extensions>true</extensions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <name>Central Portal Snapshots</name>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>central</id>
      <name>Maven Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>ossrh-snapshots</id>
      <name>Sonatype OSSRH Snapshots</name>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-release-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- Same as attach-sources profile -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <configuration>
              <skipSource>${skip.source.attach}</skipSource>
            </configuration>
            <executions>
              <execution>
                <id>release-attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

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

  <organization>
    <name>Fluxnova Community</name>
    <url>http://fluxnova.finos.org</url>
  </organization>

  <url>http://fluxnova.finos.org</url>

  <developers>
    <developer>
      <id>fluxnova.finos.org</id>
      <name>Fluxnova Community</name>
      <organization>fluxnova.finos.org</organization>
      <organizationUrl>http://fluxnova.finos.org</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/finos/fluxnova-release-parent.git</connection>
    <developerConnection>scm:git:https://github.com/finos/fluxnova-release-parent.git</developerConnection>
    <url>https://github.com/finos/fluxnova-release-parent</url>
    <tag>v2.0.0</tag>
  </scm>

  <issueManagement>
    <system>Jira</system>
    <url>https://github.com/orgs/finos/projects/116</url>
  </issueManagement>

</project>
