<?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>io.spring.platform</groupId>
        <artifactId>platform-bom</artifactId>
        <version>Cairo-SR3</version>
        <relativePath />
    </parent>

    <groupId>org.slinkyframework</groupId>
    <artifactId>slinky-build-parent</artifactId>
    <version>1.0.0</version>

    <packaging>pom</packaging>

    <name>slinky-build</name>
    <description>Slinky Build</description>
    <url>https://github.com/klyall/slinky-build</url>

    <developers>
        <developer>
            <name>Keith Lyall</name>
            <email>keith.lyall@slinkyframework.org</email>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>GNU GPLv3</name>
            <url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/klyall/slinky-build</url>
        <connection>scm:git:git@github.com:klyall/slinky-build.git</connection>
        <developerConnection>scm:git:git@github.com:klyall/slinky-build.git</developerConnection>
        <tag>slinky-build-parent-1.0.0</tag>
    </scm>
    <issueManagement>
        <url>https://github.com/klyall/slinky-build/issues</url>
        <system>GitHub</system>
    </issueManagement>
    <ciManagement>
        <url>https://travis-ci.org/klyall/slinky-build</url>
        <system>Travis-CI</system>
    </ciManagement>

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

    <properties>
        <java.version>1.8</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <jacoco.unit.file>${basedir}/target/jacoco-unit.exec</jacoco.unit.file>
        <jacoco.it.file>${basedir}/target/jacoco-it.exec</jacoco.it.file>

        <asm.version>5.0.4</asm.version>
        <checker.version>2.0.1</checker.version>
        <docker-client.version>8.11.7</docker-client.version>
        <maven.version>3.5.4</maven.version>
        <maven-invoker.version>2.1.1</maven-invoker.version>
        <maven-plugin-annotations.version>3.5.2</maven-plugin-annotations.version>
        <maven-plugin-api.version>3.5.4</maven-plugin-api.version>
        <maven-plugin-plugin.version>3.5.2</maven-plugin-plugin.version>
        <maven-project.version>2.2.1</maven-project.version>
        <plexus-utils.version>2.0.5</plexus-utils.version>
        <typesafe-config.version>1.3.1</typesafe-config.version>

        <aspectj-maven-plugin.version>1.11</aspectj-maven-plugin.version>
        <docker-maven-plugin.version>0.26.1</docker-maven-plugin.version>
        <jacoco-maven-plugin.version>0.7.7.201606060606</jacoco-maven-plugin.version>
        <maven-artifact.version>3.5.0</maven-artifact.version>
        <maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
        <maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
        <maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
        <maven-failsafe-plugin.version>2.20</maven-failsafe-plugin.version>
        <maven-jar-plugin.version>2.6</maven-jar-plugin.version>
        <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>

        <docker.expose.port>8080</docker.expose.port>
        <docker.registry.protocol>https</docker.registry.protocol>
        <docker.registry.host>localhost</docker.registry.host>
        <docker.registry.serverId />
        <docker.registry.useConfigFile>false</docker.registry.useConfigFile>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm</artifactId>
                <version>${asm.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm-tree</artifactId>
                <version>${asm.version}</version>
            </dependency>
            <dependency>
                <groupId>org.checkerframework</groupId>
                <artifactId>checker</artifactId>
                <version>${checker.version}</version>
            </dependency>
            <dependency>
                <groupId>org.checkerframework</groupId>
                <artifactId>checker-qual</artifactId>
                <version>${checker.version}</version>
            </dependency>
            <dependency>
                <groupId>org.checkerframework</groupId>
                <artifactId>jdk8</artifactId>
                <version>${checker.version}</version>
            </dependency>
            <dependency>
                <groupId>com.spotify</groupId>
                <artifactId>docker-client</artifactId>
                <version>${docker-client.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.connectors</groupId>
                <artifactId>jersey-apache-connector</artifactId>
                <version>${jersey.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-artifact</artifactId>
                <version>${maven.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-model</artifactId>
                <version>${maven.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.shared</groupId>
                <artifactId>maven-invoker</artifactId>
                <version>${maven-invoker.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>${maven-plugin-annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${maven-plugin-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-project</artifactId>
                <version>${maven-project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.typesafe</groupId>
                <artifactId>config</artifactId>
                <version>${typesafe-config.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-utils</artifactId>
                <version>${plexus-utils.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.checkerframework</groupId>
            <artifactId>checker-qual</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>${aspectj-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>test-compile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <complianceLevel>${java.version}</complianceLevel>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjrt</artifactId>
                            <version>${aspectj.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjtools</artifactId>
                            <version>${aspectj.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>${docker-maven-plugin.version}</version>
                    <configuration>
                        <imageName>${project.artifactId}</imageName>
                        <baseImage>java:8</baseImage>
                        <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint>
                        <!-- copy the service's jar file from target into the root directory of the image -->
                        <serverId>${docker.registry.serverId}</serverId>
                        <exposes>
                            <expose>${docker.expose.port}</expose>
                        </exposes>
                        <resources>
                            <resource>
                                <targetPath>/</targetPath>
                                <directory>${project.build.directory}</directory>
                                <include>${project.build.finalName}.jar</include>
                            </resource>
                        </resources>
                        <imageTags>
                            <imageTag>${project.version}</imageTag>
                            <imageTag>latest</imageTag>
                        </imageTags>
                    </configuration>
                    <executions>
                        <execution>
                            <id>build-image</id>
                            <phase>package</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>tag-image</id>
                            <phase>package</phase>
                            <goals>
                                <goal>tag</goal>
                            </goals>
                            <configuration>
                                <image>${project.artifactId}:${project.version}</image>
                                <newName>${docker.registry.host}/${project.artifactId}:${project.version}</newName>
                                <tagInfoFile>${project.build.directory}/image_info.json</tagInfoFile>
                            </configuration>
                        </execution>
                        <execution>
                            <id>push-image</id>
                            <phase>deploy</phase>
                            <goals>
                                <goal>push</goal>
                            </goals>
                            <configuration>
                                <imageName>${docker.registry.host}/${project.artifactId}:${project.version}</imageName>
                                <registryUrl>${docker.registry.protocol}://${docker.registry.host}</registryUrl>
                                <useConfigFile>${docker.registry.useConfigFile}</useConfigFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>jacoco-prepare-agent-unit-tests</id>
                            <phase>initialize</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <propertyName>jacoco.agent.argLine</propertyName>
                                <destFile>${jacoco.unit.file}</destFile>
                            </configuration>
                        </execution>
                        <execution>
                            <id>jacoco-prepare-agent-integration-tests</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <propertyName>jacoco.agent.argLine</propertyName>
                                <destFile>${jacoco.it.file}</destFile>
                            </configuration>
                        </execution>
                        <execution>
                            <id>jacoco-report-unit-tests</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${jacoco.unit.file}</dataFile>
                                <outputDirectory>${project.build.directory}/coverage/unit-tests</outputDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>jacoco-report-integration-tests</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${jacoco.it.file}</dataFile>
                                <outputDirectory>${project.build.directory}/coverage/integration-tests</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>1.8</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>3.1.1</version>
                                </requireMavenVersion>
                                <bannedDependencies>
                                    <excludes>
                                        <exclude>commons-logging:commons-logging</exclude>
                                        <exclude>log4j:log4j</exclude>
                                        <exclude>org.slf4j:slf4j-log4j12</exclude>
                                    </excludes>
                                </bannedDependencies>
                                <dependencyConvergence />
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <excludes>
                        <exclude>**/ITest*.java</exclude>
                        <exclude>**/*IntegrationTest.java</exclude>
                        <exclude>**/*IT.java</exclude>
                        <exclude>**/TestCollector.java</exclude>
                    </excludes>
                    <parallel>methods</parallel>
                    <threadCount>10</threadCount>
                    <argLine>${jacoco.agent.argLine}
                    </argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>${maven-failsafe-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/ITest*.java</include>
                                <include>**/*IntegrationTest.java</include>
                                <include>**/*IT.java</include>
                                <include>**/TestCollector.java</include>
                            </includes>
                            <parallel>suites</parallel>
                            <threadCount>10</threadCount>
                            <argLine>${jacoco.agent.argLine}
                            </argLine>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>true</useReleaseProfile>
                    <releaseProfiles>oss-release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>org/slinkyframework/**/*</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coverage-including-framework</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>org/slinkyframework/**/*Architecture*</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>checker</id>
            <dependencies>
                <dependency>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>checker</artifactId>
                </dependency>
                <dependency>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>jdk8</artifactId>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>${maven-dependency-plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>properties</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.3</version>
                        <configuration>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                            <annotationProcessors>
                                <annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
                            </annotationProcessors>
                            <compilerArgs>
                                <arg>-Xbootclasspath/p:${org.checkerframework:jdk8:jar}</arg>
                            </compilerArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>oss-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.3</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </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>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
