<?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.cibseven.community</groupId>
  <artifactId>release-parent</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <name>CIB seven Community - Release Parent Pom</name>

  <description>
    This pom defines the required plugins and profiles to allow a CIB seven Community projects build.
  </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 11 for our projects -->
    <version.java>11</version.java>
    
    <skip.cibseven.release>false</skip.cibseven.release>
    <skip.central.release>false</skip.central.release>
	
    <nexus.snapshot.repository.id>mvn-cibseven-snapshots</nexus.snapshot.repository.id>
    <nexus.snapshot.repository>https://artifacts.cibseven.org/repository/snapshots</nexus.snapshot.repository>
	
    <nexus.release.repository.id>mvn-cibseven-public</nexus.release.repository.id>
    <nexus.release.repository>https://artifacts.cibseven.org/repository/public</nexus.release.repository>

    <nexus.sonatype.url>https://central.sonatype.com</nexus.sonatype.url>
	
    <gpg.useagent>true</gpg.useagent>
    
    <plugin.version.clean>3.4.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>3.4.2</plugin.version.jar>
    <plugin.version.javadoc>3.11.2</plugin.version.javadoc>
    
    <plugin.version.deploy>3.1.3</plugin.version.deploy>
    <plugin.version.gpg>3.2.7</plugin.version.gpg>
    <plugin.version.central-publishing>0.7.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>
            <release>${version.java}</release>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${plugin.version.jar}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${plugin.version.deploy}</version>
          <configuration>
            <skip>${skip.cibseven.release}</skip>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>${plugin.version.central-publishing}</version>
          <configuration>
            <waitMaxTime>3600</waitMaxTime>
          </configuration>
        </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>
      </plugins>
    </pluginManagement>    
  </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>
    <!-- activate this profile to release to maven central -->
    <profile>
      <id>sonatype-oss-release</id>
      <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>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${plugin.version.javadoc}</version>
            <configuration>
              <quiet>false</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>
                <configuration>
                  <deploymentName>${project.groupId}:${project.artifactId}:${project.version}</deploymentName>
                  <failOnBuildFailure>true</failOnBuildFailure>
                  <publishingServerId>central-community</publishingServerId>
                  <centralBaseUrl>${nexus.sonatype.url}</centralBaseUrl>
                  <skipPublishing>${skip.central.release}</skipPublishing>
                </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>CIB seven</name>
    <url>https://cibseven.org</url>
  </organization>
  
  <url>https://cibseven.org</url>
  
  <developers>
    <developer>
	  <email>community@cibseven.org</email>
      <name>CIB seven Community</name>
      <organization>CIB seven</organization>
      <organizationUrl>https://cibseven.org</organizationUrl>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/cibseven-community-hub/release-parent</url>
    <connection>scm:git:git@github.com:cibseven-community-hub/release-parent.git</connection>
    <developerConnection>scm:git:git@github.com:cibseven-community-hub/release-parent.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/cibseven-community-hub/release-parent/issues</url>
  </issueManagement>

  <repositories>
    <repository>
      <id>maven-central</id>
      <name>Maven Central</name>
      <url>https://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <!-- Required for local builds by community users on main branch -->
      <id>mvn-cibseven-public</id>
      <name>CIB seven Public Repository</name>
      <url>https://artifacts.cibseven.org/repository/public</url>
	  <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <!-- Required for local builds by developers on maintainance branches -->
      <id>mvn-cibseven-snapshots</id>
      <name>CIB seven Snapshots repository</name>
      <url>https://artifacts.cibseven.org/repository/snapshots</url>
	  <releases>
        <enabled>false</enabled>
      </releases>
	  <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

</project>
