<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  pro!vision GmbH
  %%
  Copyright (C) pro!vision GmbH
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->

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

  <parent>
    <groupId>de.pro-vision.maven</groupId>
    <artifactId>de.pro-vision.maven.global-parent</artifactId>
    <version>37</version>
    <relativePath />
  </parent>

  <groupId>de.pro-vision.maven.spring</groupId>
  <artifactId>de.pro-vision.maven.spring.spring-boot-parent</artifactId>
  <version>1-2.1.16</version>
  <packaging>pom</packaging>

  <name>de.pro-vision.maven.spring.spring-boot-parent</name>
  <description>Parent for Spring Boot projects using the pro-vision parent as baseline.</description>
  <url>https://github.com/pro-vision/pv-build-tools</url>

  <scm>
    <connection>scm:git:https://github.com/pro-vision/pv-build-tools.git</connection>
    <developerConnection>scm:git:https://github.com/pro-vision/pv-build-tools.git</developerConnection>
    <url>https://github.com/pro-vision/pv-build-tools</url>
    <tag>HEAD</tag>
  </scm>

  <inceptionYear>2019</inceptionYear>

  <organization>
    <name>pro!vision GmbH</name>
    <url>http://www.pro-vision.de</url>
  </organization>

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

  <developers>
    <developer>
      <name>pro!vision GmbH</name>
      <organization>pro!vision GmbH</organization>
      <organizationUrl>http://www.pro-vision.de</organizationUrl>
    </developer>
  </developers>

  <properties>

    <!-- distribution settings -->
    <distribution.snapshotRepositoryId>ossrh</distribution.snapshotRepositoryId>
    <distribution.snapshotRepositoryUrl>https://oss.sonatype.org/content/repositories/snapshots</distribution.snapshotRepositoryUrl>
    <distribution.releaseRepositoryId>ossrh</distribution.releaseRepositoryId>
    <distribution.releaseRepositoryUrl>https://oss.sonatype.org/service/local/staging/deploy/maven2/</distribution.releaseRepositoryUrl>

    <!-- versions -->
    <spring-boot.version>2.1.16.RELEASE</spring-boot.version>
    <spring-cloud.version>Greenwich.SR6</spring-cloud.version>
    <spring-cloud-netflix.version>2.2.3.RELEASE</spring-cloud-netflix.version>
    <spring-cloud-kubernetes.version>1.1.4.RELEASE</spring-cloud-kubernetes.version>

    <!-- docker settings -->
    <docker.image.repository>YOUR-DOCKER-REGISTRY</docker.image.repository>
    <docker.image.prefix>pro-vision</docker.image.prefix>

  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>${spring-boot.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
        <optional>true</optional>
        <version>${spring-boot.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring-cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-netflix</artifactId>
        <version>${spring-cloud-netflix.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-netflix-dependencies</artifactId>
        <version>${spring-cloud-netflix.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-kubernetes-dependencies</artifactId>
        <version>${spring-cloud-kubernetes.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>${spring-boot.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
                <goal>build-info</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- configuration to build Docker images, disabled by default -->
        <plugin>
          <groupId>com.spotify</groupId>
          <artifactId>dockerfile-maven-plugin</artifactId>
          <version>1.4.13</version>
          <configuration>
            <repository>${docker.image.repository}/${docker.image.prefix}/${project.artifactId}</repository>
            <tag>${buildNumber}</tag>
            <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
            <skip>true</skip>
            <buildArgs>
              <JAR_FILE>target/${project.build.finalName}.jar.original</JAR_FILE>
            </buildArgs>
          </configuration>
        </plugin>

        <!-- maven dependency plugin used to unpack the jar for docker images -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <!-- unpack the resulting jar -->
            <execution>
              <id>unpack</id>
              <phase>package</phase>
              <goals>
                <goal>unpack</goal>
              </goals>
              <configuration>
                <artifactItems>
                  <artifactItem>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>${project.artifactId}</artifactId>
                    <version>${project.version}</version>
                  </artifactItem>
                </artifactItems>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <!-- gitflow customization (only for this pom) -->
        <plugin>
          <groupId>com.amashchenko.maven.plugin</groupId>
          <artifactId>gitflow-maven-plugin</artifactId>
          <inherited>false</inherited>
          <configuration>
            <gitFlowConfig>
              <releaseBranchPrefix>release/${project.artifactId}-</releaseBranchPrefix>
              <hotfixBranchPrefix>hotfix/${project.artifactId}-</hotfixBranchPrefix>
              <versionTagPrefix>${project.artifactId}-</versionTagPrefix>
            </gitFlowConfig>
          </configuration>
        </plugin>
        <plugin>
          <groupId>external.atlassian.jgitflow</groupId>
          <artifactId>jgitflow-maven-plugin</artifactId>
          <inherited>false</inherited>
          <configuration>
            <!-- Prefix release numbers with artifactId for GIT repo with more than one released artifact -->
            <flowInitContext>
              <releaseBranchPrefix>release/${project.artifactId}-</releaseBranchPrefix>
              <hotfixBranchPrefix>hotfix/${project.artifactId}-</hotfixBranchPrefix>
              <versionTagPrefix>${project.artifactId}-</versionTagPrefix>
            </flowInitContext>
          </configuration>
        </plugin>

      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <!-- release-profile -->
    <profile>
      <id>release-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <!-- sign the build (only for this pom, not inherited)  -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- configure staging process at sonatype (only for this pom, not inherited) -->
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <inherited>false</inherited>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <!-- Deployed artifacts should go to staging to be reviewed before publish -->
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <repository>
      <id>${distribution.releaseRepositoryId}</id>
      <url>${distribution.releaseRepositoryUrl}</url>
    </repository>
    <snapshotRepository>
      <id>${distribution.snapshotRepositoryId}</id>
      <url>${distribution.snapshotRepositoryUrl}</url>
    </snapshotRepository>
  </distributionManagement>

</project>
