<?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>eu.prismacapacity</groupId>
  <artifactId>basepom-oss</artifactId>
  <version>0.2.18</version>
  <packaging>pom</packaging>

  <!-- local to basepom, please override this info in your derived project -->

  <name>PRISMA OSS BasePom</name>
  <url>https://github.com/prisma-capacity/basepom-oss</url>
  <description>This should serve as a default for OSS Projects published
    by PRISMA European Capacity Platform GmbH</description>
  <developers>
    <developer>
      <id>uwe.schaefer</id>
      <name>Uwe Schaefer</name>
      <email>uwe.schaefer@prisma-capacity.eu</email>
    </developer>
  </developers>

  <!-- / local to basepom, please override this info in your derived project -->

  <organization>
    <name>PRISMA European Capacity Platform GmbH</name>
    <url>http://www.prisma-capacity.eu</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>
  <!-- Default value, should be overwritten in actual project -->
  <inceptionYear>2020</inceptionYear>
  <issueManagement>
    <system>github</system>
    <url>https://github.com/prisma-capacity/basepom-oss/issues</url>
  </issueManagement>
  <scm>
    <connection>scm:git:git@github.com:prisma-capacity/basepom-oss.git</connection>
    <developerConnection>scm:git:git@github.com:prisma-capacity/basepom-oss.git</developerConnection>
    <url>https://github.com/prisma-capacity/basepom-oss.git</url>
    <tag>HEAD</tag>
  </scm>
  <properties>
    <!-- sane default -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <!-- plugin versions -->
    <maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>
    <maven-javadoc-plugin.version>3.11.2</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>
    <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
    <jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
    <dependency-check-maven.version>12.1.0</dependency-check-maven.version>
    <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
    <directory-maven-plugin.version>1.0</directory-maven-plugin.version>
    <spotless-maven-plugin.version>2.44.1</spotless-maven-plugin.version>
    <etc>${session.executionRootDirectory}/src/etc</etc>
    <formatter.config>${etc}/format</formatter.config>
    <jersey-client.version>1.19.4</jersey-client.version>
  </properties>
  <build>
    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless-maven-plugin.version}</version>
        <configuration>
          <formats>
            <format>
              <includes>
                <include>src/main/*.xml</include>
                <include>pom.xml</include>
              </includes>
              <eclipseWtp>
                <type>XML</type>
                <version>4.21.0</version>
              </eclipseWtp>
              <indent>
                <spaces>true</spaces>
                <spacesPerTab>2</spacesPerTab>
              </indent>
            </format>
          </formats>
          <java>
            <toggleOffOn />
            <importOrder>
              <order>java,javax,org,com</order>
            </importOrder>
            <googleJavaFormat>
              <version>1.17.0</version>
              <style>GOOGLE</style>
            </googleJavaFormat>
            <licenseHeader>
              <file>${etc}/header.txt</file>
            </licenseHeader>
          </java>
          <ratchetFrom>origin/main</ratchetFrom>
        </configuration>
      </plugin>
      <plugin>
        <groupId>eu.prismacapacity</groupId>
        <artifactId>unixuid-maven-plugin</artifactId>
        <version>1.0.8</version>
        <executions>
          <execution>
            <goals>
              <goal>unixuid</goal>
            </goals>
            <phase>initialize</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.7.1</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>detect</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.amashchenko.maven.plugin</groupId>
        <artifactId>gitflow-maven-plugin</artifactId>
        <version>1.21.0</version>
        <configuration>
          <gitFlowConfig>
            <productionBranch>main</productionBranch>
            <developmentBranch>main</developmentBranch>
          </gitFlowConfig>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven-clean-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.commonjava.maven.plugins</groupId>
          <artifactId>directory-maven-plugin</artifactId>
          <version>${directory-maven-plugin.version}</version>
          <executions>
            <execution>
              <id>directories</id>
              <goals>
                <goal>highest-basedir</goal>
              </goals>
              <phase>initialize</phase>
              <configuration>
                <property>repository.root</property>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
              </manifest>
              <manifestEntries>
                <Implementation-Branch>${scmBranch}</Implementation-Branch>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <profiles>
    <profile>
      <id>oss.release-sign-artifacts</id>
      <activation>
        <property>
          <name>central</name>
        </property>
      </activation>
      <distributionManagement>
        <repository>
          <id>central-snapshot</id>
          <name>Central Portal Snapshots</name>
          <url>https://central.sonatype.com/repository/maven-snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </distributionManagement>
      <build>
        <plugins>
          <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>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.7.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>false</autoPublish>
              <waitUntil>published</waitUntil>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <additionalOptions>
                    <additionalOption>-Xdoclint:none</additionalOption>
                  </additionalOptions>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- Attach source-jar -->
      <id>oss-sourcejar</id>
      <activation>
        <file>
          <missing>.no-sourcejar</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- Attach test-jar -->
      <id>oss-testjar</id>
      <activation>
        <file>
          <missing>.no-testjar</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>test-jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- Generate JavaDocs with -Xdoclint:none -->
      <id>oss-javadoc</id>
      <activation>
        <file>
          <missing>.no-javadoc</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalOptions>
                    <additionalOption>-Xdoclint:none</additionalOption>
                  </additionalOptions>
                </configuration>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- Check dependencies for known vulnerabilities -->
      <id>oss-owasp</id>
      <activation>
        <file>
          <missing>.no-owasp</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>${dependency-check-maven.version}</version>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <suppressionFile>${session.executionRootDirectory}/suppressions.xml</suppressionFile>
              <failOnError>true</failOnError>
              <failBuildOnCVSS>8</failBuildOnCVSS>
              <skipRuntimeScope>true</skipRuntimeScope>
              <skipProvidedScope>true</skipProvidedScope>
              <skipTestScope>true</skipTestScope>
              <skipSystemScope>true</skipSystemScope>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>oss-jacoco</id>
      <activation>
        <file>
          <missing>.no-jacoco</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco-maven-plugin.version}</version>
            <executions>
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <phase>test</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <excludes>
                <!-- Spring specific classes -->
                <exclude>**/*Configuration.*</exclude>
                <exclude>**/*Application.*</exclude>
                <!-- Exceptions -->
                <exclude>**/*Exception.*</exclude>
                <!-- proto-generated classes -->
                <exclude>**/gen/*</exclude>
                <exclude>**/generated/*</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
