<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2019 Wave Software
  ~
  ~ 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.
  -->

<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.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.1.5.RELEASE</version>
    <relativePath />
  </parent>
  <groupId>pl.wavesoftware.testing</groupId>
  <artifactId>testing-starter-parent</artifactId>
  <version>1.0.0</version>
  <packaging>pom</packaging>
  <name>Testing Starter</name>
  <description>
    A simple testing starter for Java projects
  </description>

  <url>http://wavesoftware.github.io/java-testing-starter/</url>
  <inceptionYear>2019</inceptionYear>

  <organization>
    <name>Wave Software</name>
    <url>http://wavesoftware.pl</url>
  </organization>

  <licenses>
    <license>
      <name>Apache License 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>cardil</id>
      <email>krzysztof.suszynski@wavesoftware.pl</email>
      <name>Krzysztof Suszynski</name>
      <organization>Wave Software</organization>
    </developer>
  </developers>

  <modules>
    <module>junit5-starter</module>
    <module>ansi</module>
    <module>log4j2</module>
    <module>examples</module>
  </modules>
  
  <scm>
    <connection>scm:git:https://github.com/wavesoftware/java-testing-starter.git</connection>
    <developerConnection>scm:git:git@github.com:wavesoftware/java-testing-starter.git</developerConnection>
    <url>https://github.com/wavesoftware/java-testing-starter</url>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/wavesoftware/java-testing-starter/issues</url>
  </issueManagement>

  <ciManagement>
    <system>Travis CI</system>
    <url>https://travis-ci.org/wavesoftware/java-testing-starter</url>
  </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>
    <project.rootdir>${project.basedir}</project.rootdir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <sonar.working.directory>${project.build.directory}/sonar</sonar.working.directory>
    <sonar.host.url>https://sonar.wavesoftware.pl</sonar.host.url>
    <sonar.jacoco.dataPath>${project.rootdir}/target/jacoco.exec</sonar.jacoco.dataPath>
    <sonar.jacoco.itDataPath>${project.rootdir}/target/jacoco-it.exec</sonar.jacoco.itDataPath>
    <sonar.jacoco.reportPaths>${project.rootdir}/target/jacoco.exec,${project.rootdir}/target/jacoco-it.exec</sonar.jacoco.reportPaths>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <java.source.version>8</java.source.version>
    <sonar.java.source>${java.source.version}</sonar.java.source>
    <maven.compiler.source>1.${java.source.version}</maven.compiler.source>
    <maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
    <unpack-manifestmf.skip>true</unpack-manifestmf.skip>

    <skipTests />
    <coveralls.skip>${skipTests}</coveralls.skip>
    <sonar.skip>${skipTests}</sonar.skip>
  </properties>
  
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apiguardian</groupId>
        <artifactId>apiguardian-api</artifactId>
        <version>1.0.0</version>
      </dependency>
      <dependency>
        <groupId>io.vavr</groupId>
        <artifactId>vavr</artifactId>
        <version>0.10.0</version>
      </dependency>
      <dependency>
        <groupId>pl.wavesoftware</groupId>
        <artifactId>eid-exceptions</artifactId>
        <version>2.0.0</version>
      </dependency>
      
      <!-- Test -->
      <dependency>
        <groupId>org.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>3.1.6</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.portingle</groupId>
        <artifactId>slf4jtesting</artifactId>
        <version>1.1.3</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>3.6.0.1398</version>
        </plugin>
        <plugin>
          <groupId>com.manamind.jgitflow</groupId>
          <artifactId>jgitflow-maven-plugin</artifactId>
          <version>1.0.0</version>
          <configuration>
            <enableSshAgent>true</enableSshAgent>
            <flowInitContext>
              <versionTagPrefix>v</versionTagPrefix>
            </flowInitContext>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.3</version>
          <executions>
            <execution>
              <id>jacoco-initialize</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
              <configuration>
                <append>true</append>
                <destFile>${sonar.jacoco.dataPath}</destFile>
              </configuration>
            </execution>
            <execution>
              <id>jacoco-initialize-it</id>
              <goals>
                <goal>prepare-agent-integration</goal>
              </goals>
              <configuration>
                <append>true</append>
                <destFile>${sonar.jacoco.itDataPath}</destFile>
              </configuration>
            </execution>
            <execution>
              <id>jacoco-site</id>
              <phase>test</phase>
              <goals>
                <goal>report</goal>
              </goals>
              <configuration>
                <dataFile>${sonar.jacoco.dataPath}</dataFile>
              </configuration>
            </execution>
            <execution>
              <id>jacoco-site-it</id>
              <phase>post-integration-test</phase>
              <goals>
                <goal>report-integration</goal>
              </goals>
              <configuration>
                <dataFile>${sonar.jacoco.itDataPath}</dataFile>
              </configuration>
            </execution>
          </executions>
          <configuration>
            <includes>
              <include>pl/wavesoftware/**</include>
            </includes>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
          <configuration>
            <compilerArgs>
              <arg>-Werror</arg>
              <arg>-Xlint:all,-processing</arg>
            </compilerArgs>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
              <manifestEntries>
                <Implementation-Artifact-Id>${project.artifactId}</Implementation-Artifact-Id>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.2</version>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.22.2</version>
          <configuration>
            <trimStackTrace>false</trimStackTrace>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>

        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.0.1</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.0.1</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.7.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.gmaven</groupId>
          <artifactId>groovy-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-manifest-mf</id>
            <phase>package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <skip>${unpack-manifestmf.skip}</skip>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>${project.artifactId}</artifactId>
                  <version>${project.version}</version>
                  <type>${project.packaging}</type>
                  <includes>META-INF/MANIFEST.MF</includes>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/classes</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>jacoco</id>
      <activation>
        <property>
          <name>env.JACOCO</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>sonar</id>
      <activation>
        <property>
          <!-- tries to determine is interactive user session -->
          <name>env.GDMSESSION</name>
        </property>
      </activation>
      <properties>
        <sonar.analysis.mode>preview</sonar.analysis.mode>
        <sonar.issuesReport.console.enable>true</sonar.issuesReport.console.enable>
        <sonar.issuesReport.html.enable>true</sonar.issuesReport.html.enable>
        <sonar.report.export.path>issues.json</sonar.report.export.path>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>

          <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>default</id>
                <phase>verify</phase>
                <goals>
                  <goal>sonar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release-profile</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release-checks</id>
      <activation>
        <property>
          <name>env.RELEASE_CHECKS</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
