<?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.camunda</groupId>
  <artifactId>camunda-release-parent</artifactId>
  <version>3.7.6</version>
  <packaging>pom</packaging>
  <name>camunda - Release Parent Pom</name>

  <description>
    This pom defines the required plugins and profiles to allow a camunda release build.
    Inherit this pom when you want to release your project into the camunda nexus and/or 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 1.7 for our projects -->
    <version.java>1.7</version.java>
    <version.ejb>3.1</version.ejb>

    <skip.camunda.release>false</skip.camunda.release>
    <skip.central.release>false</skip.central.release>
    <nexus.snapshot.repository.id>camunda-nexus</nexus.snapshot.repository.id>
    <nexus.snapshot.repository>https://artifacts.camunda.com/artifactory/camunda-bpm-snapshots</nexus.snapshot.repository>
    <nexus.release.repository.id>camunda-nexus</nexus.release.repository.id>
    <nexus.release.repository>https://artifacts.camunda.com/artifactory/camunda-bpm</nexus.release.repository>

    <nexus.staging.deploy.id>camunda-nexus</nexus.staging.deploy.id>
    <nexus.staging.deploy.url>https://artifacts.camunda.com/artifactory</nexus.staging.deploy.url>
    <gpg.useagent>true</gpg.useagent>

    <plugin.version.clean>2.6</plugin.version.clean>
    <plugin.version.source>2.3</plugin.version.source>
    <plugin.version.compiler>3.1</plugin.version.compiler>
    <plugin.version.jar>2.5</plugin.version.jar>
    <plugin.version.javadoc>2.9.1</plugin.version.javadoc>
    <plugin.version.maven-bundle>2.5.3</plugin.version.maven-bundle>


    <plugin.version.deploy>2.8.2</plugin.version.deploy>
    <plugin.version.assembly>2.4.1</plugin.version.assembly>
    <plugin.version.ejb>2.4</plugin.version.ejb>
    <plugin.version.war>2.4</plugin.version.war>
    <plugin.version.ear>2.9.1</plugin.version.ear>
    <plugin.version.rar>2.4</plugin.version.rar>
    <plugin.version.gpg>1.4</plugin.version.gpg>
    <plugin.version.release>2.5.3</plugin.version.release>
    <plugin.version.nexus-staging>1.6.8</plugin.version.nexus-staging>
    <plugin.version.central-publishing>0.8.0</plugin.version.central-publishing>
  </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-enforcer-plugin</artifactId>
          <version>3.4.1</version>
        </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>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <useReleaseProfile>false</useReleaseProfile>
            <!-- 
              This ensures that the deployment name in the Sonatype Central Portal for projects using the maven-release-plugin 
              is set by default to the top-level module’s groupId, artifactId, and version.
              deploymentName is superseded if the central.sonatype.deployment.name property is set.
            -->
            <arguments>${arguments} -Pcentral-sonatype-publish -DdeploymentName=${project.groupId}:${project.artifactId}:${releaseVersion}</arguments>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${plugin.version.deploy}</version>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>${plugin.version.central-publishing}</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>${plugin.version.nexus-staging}</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>
        </plugin>
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
          <version>${plugin.version.maven-bundle}</version>
          <extensions>true</extensions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>default-deploy</id>
            <phase>deploy</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <detectBuildFailures>true</detectBuildFailures>
              <serverId>${nexus.staging.deploy.id}</serverId>
              <nexusUrl>${nexus.staging.deploy.url}</nexusUrl>
              <skipStaging>true</skipStaging>
              <skipNexusStagingDeployMojo>${skip.camunda.release}</skipNexusStagingDeployMojo>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <distributionManagement>
    <snapshotRepository>
      <id>${nexus.snapshot.repository.id}</id>
      <url>${nexus.snapshot.repository}</url>
    </snapshotRepository>
    <repository>
      <id>${nexus.release.repository.id}</id>
      <url>${nexus.release.repository}</url>
    </repository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>override-snapshot-repository</id>
      <activation>
        <property>
          <name>env.NEXUS_SNAPSHOT_REPOSITORY</name>
        </property>
      </activation>
      <properties>
        <nexus.snapshot.repository>${env.NEXUS_SNAPSHOT_REPOSITORY}</nexus.snapshot.repository>
      </properties>
    </profile>
    <profile>
      <id>override-snapshot-repository-id</id>
      <activation>
        <property>
          <name>env.NEXUS_SNAPSHOT_REPOSITORY_ID</name>
        </property>
      </activation>
      <properties>
        <nexus.snapshot.repository.id>${env.NEXUS_SNAPSHOT_REPOSITORY_ID}</nexus.snapshot.repository.id>
      </properties>
    </profile>
    <profile>
      <id>override-release-repository</id>
      <activation>
        <property>
          <name>env.NEXUS_RELEASE_REPOSITORY</name>
        </property>
      </activation>
      <properties>
        <nexus.release.repository>${env.NEXUS_RELEASE_REPOSITORY}</nexus.release.repository>
      </properties>
    </profile>
    <profile>
      <id>override-release-repository-id</id>
      <activation>
        <property>
          <name>env.NEXUS_RELEASE_REPOSITORY_ID</name>
        </property>
      </activation>
      <properties>
        <nexus.release.repository.id>${env.NEXUS_RELEASE_REPOSITORY_ID}</nexus.release.repository.id>
      </properties>
    </profile>
    <!-- activate this profile to release to maven central -->
    <profile>
      <id>central-sonatype-publish</id>
      <properties>
        <serverId>central</serverId>
        <!-- 
          deploymentName is redundant with central.sonatype.deployment.name but is kept for backward compatibility.
          It is now only meant to be used in the arguments of the maven-release-plugin (currently appended by default, see configuration).  
        -->
        <deploymentName>Deployment</deploymentName>
        <!-- 
          If central.sonatype.deployment.name is set, it always takes precedence over deploymentName.
          This is the property that child POMs inheriting from this POM should use to override the deployment name in the Sonatype Central Portal.
        -->
        <central.sonatype.deployment.name>${deploymentName}</central.sonatype.deployment.name>
      </properties>      
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${plugin.version.source}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
              <execution>
                <id>attach-test-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>test-jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${plugin.version.javadoc}</version>
            <configuration>
              <quiet>true</quiet>
            </configuration>
            <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>
            <version>${plugin.version.gpg}</version>
            <configuration>
              <passphrase>${gpg.passphrase}</passphrase>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>central-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>publish</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <autoPublish>false</autoPublish>
              <checksums>required</checksums>
              <deploymentName>${central.sonatype.deployment.name}</deploymentName>
              <failOnBuildFailure>true</failOnBuildFailure>
              <publishingServerId>${serverId}</publishingServerId>
              <skipPublishing>${skip.central.release}</skipPublishing>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- activate this profile to release to maven central -->
    <profile>
      <id>sonatype-oss-release</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-release-plugin</artifactId>
              <configuration>
                <arguments>${arguments}</arguments>
              </configuration>
              </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${plugin.version.source}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
              <execution>
                <id>attach-test-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>test-jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${plugin.version.javadoc}</version>
            <configuration>
              <quiet>true</quiet>
            </configuration>
            <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>
            <version>${plugin.version.gpg}</version>
            <configuration>
              <passphrase>${gpg.passphrase}</passphrase>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <extensions>true</extensions>
            <executions>
              <execution>
                <id>central-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
                <configuration>
                  <detectBuildFailures>true</detectBuildFailures>
                  <keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
                  <keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
                  <serverId>central</serverId>
                  <nexusUrl>https://ossrh-staging-api.central.sonatype.com</nexusUrl>
                  <skipStaging>false</skipStaging>
                  <skipNexusStagingDeployMojo>${skip.central.release}</skipNexusStagingDeployMojo>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>warn-deprecated-profile</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <evaluateBeanshell>
                      <condition>false</condition>
                      <message>
⚠️ Deprecated Profile Notice: The sonatype-oss-release profile is deprecated and will be removed in a future release.

A new profile, central-sonatype-publish, is available for use with the new Sonatype Central Portal publishing interface.
Please refer to the documentation for migration guidance:
https://github.com/camunda/camunda-release-parent/tree/master?tab=readme-ov-file#%EF%B8%8F-migration-to-sonatype-central-portal
                      </message>
                    </evaluateBeanshell>
                  </rules>
                  <fail>false</fail>
                </configuration>
              </execution>
              <execution>
                <id>fail-deprecated-profile-zeebe-no-ackn</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <evaluateBeanshell>
                        <condition><![CDATA[
                          !"${project.groupId}".startsWith("io.zeebe") ||
                          "${sonatype-oss-release.acknowledge.deprecation}".equals("true")
                          ]]>
                        </condition>
                        <message>
❌ Deployment Blocked: Publishing under the io.zeebe namespace using the deprecated sonatype-oss-release profile is no longer supported.
To deploy to Maven Central, please use the  profile, which supports the new Central Portal publishing interface.

🛑 To bypass this check (not recommended), you may pass -Dsonatype-oss-release.acknowledge.deprecation=true.

Please refer to the documentation for migration guidance and namespace-specific rollout details:
https://github.com/camunda/camunda-release-parent/tree/master?tab=readme-ov-file#%EF%B8%8F-migration-to-sonatype-central-portal
                        </message>
                      </evaluateBeanshell>
                    </rules>
                  <fail>true</fail>
                </configuration>
              </execution>
              <execution>
                <id>fail-deprecated-profile-io-camunda-no-ackn</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <evaluateBeanshell>
                        <condition><![CDATA[
                          !"${project.groupId}".startsWith("io.camunda") ||
                          "${sonatype-oss-release.acknowledge.deprecation}".equals("true")
                          ]]>
                        </condition>
                        <message>
❌ Deployment Blocked: Publishing under the io.camunda namespace using the deprecated sonatype-oss-release profile is no longer supported.
To deploy to Maven Central, please use the  profile, which supports the new Central Portal publishing interface.

🛑 To bypass this check (not recommended), you may pass -Dsonatype-oss-release.acknowledge.deprecation=true.

Please refer to the documentation for migration guidance and namespace-specific rollout details:
https://github.com/camunda/camunda-release-parent/tree/master?tab=readme-ov-file#%EF%B8%8F-migration-to-sonatype-central-portal
                        </message>
                      </evaluateBeanshell>
                    </rules>
                  <fail>true</fail>
                </configuration>
              </execution>
              <execution>
                <id>fail-deprecated-profile-org-camunda-no-ackn</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <evaluateBeanshell>
                        <condition><![CDATA[
                          !"${project.groupId}".startsWith("org.camunda") ||
                          "${sonatype-oss-release.acknowledge.deprecation}".equals("true")
                          ]]>
                        </condition>
                        <message>
❌ Deployment Blocked: Publishing under the org.camunda namespace using the deprecated sonatype-oss-release profile is no longer supported.
To deploy to Maven Central, please use the  profile, which supports the new Central Portal publishing interface.

🛑 To bypass this check (not recommended), you may pass -Dsonatype-oss-release.acknowledge.deprecation=true.

Please refer to the documentation for migration guidance and namespace-specific rollout details:
https://github.com/camunda/camunda-release-parent/tree/master?tab=readme-ov-file#%EF%B8%8F-migration-to-sonatype-central-portal
                        </message>
                      </evaluateBeanshell>
                    </rules>
                  <fail>true</fail>
                </configuration>
              </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>Camunda Services GmbH</name>
    <url>http://www.camunda.com</url>
  </organization>

  <url>http://www.camunda.org</url>

  <developers>
    <developer>
      <id>camunda.org</id>
      <name>camunda BPM Community</name>
      <organization>camunda.org</organization>
      <organizationUrl>http://camunda.org</organizationUrl>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/camunda/camunda-release-parent</url>
    <connection>scm:git:git@github.com:camunda/camunda-release-parent.git</connection>
    <developerConnection>scm:git:git@github.com:camunda/camunda-release-parent.git</developerConnection>
    <tag>3.7.6</tag>
  </scm>

  <issueManagement>
    <system>Jira</system>
    <url>https://app.camunda.com/jira/browse/CAM/</url>
  </issueManagement>

</project>
