<?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>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>
    <groupId>eu.prismacapacity</groupId>
    <artifactId>basepom-oss</artifactId>
    <version>0.1.1</version>
    <packaging>pom</packaging>
    <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.1.0</maven-clean-plugin.version>
        <maven-javadoc-plugin.version>3.1.0</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.1.0</maven-source-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-jar-plugin.version>3.1.2</maven-jar-plugin.version>
        <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
        <dependency-check-maven.version>5.3.0</dependency-check-maven.version>
        <nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
        <directory-maven-plugin.version>0.3.1</directory-maven-plugin.version>
        <spotless-maven-plugin.version>1.27.0</spotless-maven-plugin.version>
        <etc>${session.executionRootDirectory}/src/etc</etc>
        <formatter.config>${etc}/format</formatter.config>
	<jersey-client.version>1.18.6</jersey-client.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.6.2</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.14.0</version>
                <configuration>
                    <gitFlowConfig>
                        <developmentBranch>master</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>
            <!-- format sources -->
            <id>spotless</id>
            <activation>
                <file>
                    <exists>${formatter.config}/eclipse_code_formatter.xml</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.diffplug.spotless</groupId>
                        <artifactId>spotless-maven-plugin</artifactId>
                        <version>${spotless-maven-plugin.version}</version>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <java>
                                <licenseHeader>
                                    <file>file://${etc}/header.txt</file>
                                </licenseHeader>
                                <eclipse>
                                    <file>file://${formatter.config}/eclipse_code_formatter.xml</file>
                                    <version>4.11.0</version>
                                </eclipse>
                                <trimTrailingWhitespace />
                                <removeUnusedImports />
                                <importOrder>
                                    <file>file://${formatter.config}/eclipse.importorder</file>
                                </importOrder>
                                <includes>
                                    <include> **/src/main/java/**/*.java 
                                    </include>
                                </includes>
                            </java>
                            <kotlin>
                                <licenseHeader>
                                    <file>file://${etc}/header.txt</file>
                                </licenseHeader>
                                <trimTrailingWhitespace />
                                <ktlint>
                                    <!-- Optional, available versions: https://github.com/shyiko/ktlint/releases -->
                                    <version>0.36.0</version>
                                </ktlint>
                                <includes>
                                    <include> **/src/main/kotlin/**/*.kt 
                                    </include>
                                </includes>
                            </kotlin>
                            <xml>
                                <trimTrailingWhitespace />
                                <includes>
                                    <include>**/src/**/*.xml</include>
                                    <include>**/pom.xml</include>
                                </includes>
                                <eclipseWtp>
                                    <type>XML</type>
                                    <version>4.7.3a</version>
                                    <files>
                                        <file>${formatter.config}/eclipse_xml_formatter.properties</file>
                                    </files>
                                </eclipseWtp>
                                <indent>
                                    <spaces>true</spaces>
                                    <spacesPerTab>2</spacesPerTab>
                                </indent>
                            </xml>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>oss.release-sign-artifacts</id>
            <activation>
                <property>
                    <name>ossrh</name>
                </property>
            </activation>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </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>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.sun.jersey</groupId>
                                <artifactId>jersey-client</artifactId>
                                <version>${jersey-client.version}</version>
                            </dependency>
                        </dependencies>
                    </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>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <failOnError>true</failOnError>
                            <failBuildOnAnyVulnerability>true</failBuildOnAnyVulnerability>
                            <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>
                        </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>