<!--
  ~ Copyright (c) 2016, spals
  ~ All rights reserved.
  ~
  ~ Redistribution and use in source and binary forms, with or without modification, are permitted
  ~ provided that the following conditions are met:
  ~
  ~ 1. Redistributions of source code must retain the above copyright notice, this list of conditions
  ~ and the following disclaimer.
  ~
  ~ 2. Redistributions in binary form must reproduce the above copyright notice, this list of
  ~ conditions and the following disclaimer in the documentation and/or other materials
  ~ provided with the distribution.
  ~
  ~ 3. Neither the name of the copyright holder nor the names of its contributors may be used to
  ~ endorse or promote products derived from this software without specific prior written
  ~ permission.
  ~
  ~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  ~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  ~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  ~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  ~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  ~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  ~ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ~ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  ~ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  ~ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  -->

<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>net.spals</groupId>
    <artifactId>spals-parent-pom</artifactId>
    <version>22</version>
    <packaging>pom</packaging>

    <name>parent-pom</name>
    <description>
        Parent pom for spals projects
    </description>
    <url>https://github.com/spals/parent-pom</url>

    <developers>
        <developer>
            <name>Jim Spagnola</name>
        </developer>
        <developer>
            <name>Tim Kral</name>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/spals/parent-pom.git</connection>
        <developerConnection>scm:git:git@github.com:spals/parent-pom.git</developerConnection>
        <url>https://github.com/spals/parent-pom</url>
    </scm>

    <licenses>
        <license>
            <name>The BSD 3-Clause License</name>
            <url>http://opensource.org/licenses/BSD-3-Clause</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Java version -->
        <java.version>1.8</java.version>

        <!-- Scala version -->
        <scala.version>2.11</scala.version>
        <scala-library.version>2.11.8</scala-library.version>

        <!-- Dependency versions -->
        <auto-value.version>1.3</auto-value.version>
        <catch-exception.version>2.0.0-ALPHA-1</catch-exception.version>
        <freebuilder.version>1.14.1</freebuilder.version>
        <groovy.version>2.4.12</groovy.version>
        <guava.version>20.0</guava.version>
        <guice.version>4.1.0</guice.version>
        <hamcrest.version>2.0.0.0</hamcrest.version>
        <jackson.version>2.8.11</jackson.version>
        <!-- Upgrade Jackson databind version for critical security patch -->
        <jackson.databind.version>2.8.11.3</jackson.databind.version>
        <mockito.version>2.2.26</mockito.version>
        <scala-java8-compat.version>0.8.0</scala-java8-compat.version>
        <scalapb.version>0.5.47</scalapb.version>
        <scalatest.version>3.0.1</scalatest.version>
        <slf4j.version>1.7.21</slf4j.version>
        <testng.version>6.9.10</testng.version>

        <!-- Plugin versions -->
        <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
        <coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
        <docker-maven-plugin.version>0.21.0</docker-maven-plugin.version>
        <download-maven-plugin.version>1.3.0</download-maven-plugin.version>
        <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
        <gmavenplus-plugin.version>1.5</gmavenplus-plugin.version>
        <jacoco-maven-plugin.version>0.8.2</jacoco-maven-plugin.version>
        <maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
        <maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
        <maven-failsafe-plugin.version>2.8.1</maven-failsafe-plugin.version>
        <maven-gpg-plugin.version>1.5</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>2.9.1</maven-javadoc-plugin.version>
        <maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>2.8.1</maven-surefire-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.3</nexus-staging-maven-plugin.version>
        <os-maven-plugin.version>1.5.0.Final</os-maven-plugin.version>
        <protobuf-maven-plugin.version>0.5.1</protobuf-maven-plugin.version>
        <protoc-jar-maven-plugin.version>3.2.0.1</protoc-jar-maven-plugin.version>
        <scala-maven-plugin.version>3.3.1</scala-maven-plugin.version>
        <scalatest-maven-plugin.version>1.0</scalatest-maven-plugin.version>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <name>Sonatype Nexus OSS Snapshot Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.databind.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jdk8</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.auto.value</groupId>
                <artifactId>auto-value</artifactId>
                <version>${auto-value.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava-testlib</artifactId>
                <version>${guava.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.google.inject</groupId>
                <artifactId>guice</artifactId>
                <version>${guice.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.inject.extensions</groupId>
                <artifactId>guice-assistedinject</artifactId>
                <version>${guice.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.inject.extensions</groupId>
                <artifactId>guice-grapher</artifactId>
                <version>${guice.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.inject.extensions</groupId>
                <artifactId>guice-multibindings</artifactId>
                <version>${guice.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.inject.extensions</groupId>
                <artifactId>guice-servlet</artifactId>
                <version>${guice.version}</version>
            </dependency>
            <dependency>
                <groupId>com.trueaccord.scalapb</groupId>
                <artifactId>scalapbc_${scala.version}</artifactId>
                <version>${scalapb.version}</version>
            </dependency>
            <dependency>
                <groupId>com.trueaccord.scalapb</groupId>
                <artifactId>scalapb-runtime_${scala.version}</artifactId>
                <version>${scalapb.version}</version>
            </dependency>
            <dependency>
                <groupId>eu.codearte.catch-exception</groupId>
                <artifactId>catch-exception</artifactId>
                <version>${catch-exception.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>eu.codearte.catch-exception</groupId>
                <artifactId>catch-throwable</artifactId>
                <version>${catch-exception.version}</version>
                <scope>test</scope>
            </dependency>
            <!-- hamcrest needs to be before mockito/testng otherwise the wrong assert is used -->
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>java-hamcrest</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.inferred</groupId>
                <artifactId>freebuilder</artifactId>
                <version>${freebuilder.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${scala-library.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang.modules</groupId>
                <artifactId>scala-java8-compat_${scala.version}</artifactId>
                <version>${scala-java8-compat.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${scala.version}</artifactId>
                <version>${scalatest.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jul-to-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${maven-antrun-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.gmavenplus</groupId>
                    <artifactId>gmavenplus-plugin</artifactId>
                    <version>${gmavenplus-plugin.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy-all</artifactId>
                            <version>${groovy.version}</version>
                            <scope>runtime</scope>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>com.googlecode.maven-download-plugin</groupId>
                    <artifactId>download-maven-plugin</artifactId>
                    <version>${download-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${exec-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>com.github.os72</groupId>
                    <artifactId>protoc-jar-maven-plugin</artifactId>
                    <version>${protoc-jar-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.xolstice.maven.plugins</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>${protobuf-maven-plugin.version}</version>
                    <configuration>
                        <protoSourceRoot>${basedir}/src/main/protobuf</protoSourceRoot>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>${scala-maven-plugin.version}</version>
                    <!-- Common scala compiler configuration -->
                    <configuration>
                        <scalaVersion>${scala-library.version}</scalaVersion>
                    </configuration>
                </plugin>

                <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.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven-shade-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <parallel>methods</parallel>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.scalatest</groupId>
                    <artifactId>scalatest-maven-plugin</artifactId>
                    <version>${scalatest-maven-plugin.version}</version>
                    <configuration>
                        <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                        <junitxml>.</junitxml>
                    </configuration>
                    <executions>
                        <execution>
                            <id>test</id>
                            <goals>
                                <goal>test</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>${docker-maven-plugin.version}</version>
                    <configuration>
                        <apiVersion>1.23</apiVersion>
                        <autoPull>true</autoPull>
                        <logDate>default</logDate>
                        <useColor>true</useColor>
                        <verbose>true</verbose>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <configuration>
                        <includes>
                            <include>**/*IT.java</include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.eluder.coveralls</groupId>
                    <artifactId>coveralls-maven-plugin</artifactId>
                    <version>${coveralls-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>${nexus-staging-maven-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>deploy</id>
            <activation>
                <property>
                    <name>deploy</name>
                </property>
            </activation>

            <properties>
                <gpg.executable>${env.GPG_EXECUTABLE}</gpg.executable>
                <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</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>
                        <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>
                        <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>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>deployScala</id>
            <activation>
                <file>
                    <exists>src/main/scala</exists>
                </file>
                <property>
                    <name>deploy</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-scala-sources</id>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>attach-scala-javadocs</id>
                                <goals>
                                    <goal>doc-jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>generateProtobufJava</id>
            <activation>
                <file>
                    <exists>src/main/protobuf/generateJava.marker</exists>
                </file>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.os72</groupId>
                        <artifactId>protoc-jar-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-protobuf-java</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <type>java</type>
                                    <outputDirectorySuffix>protobuf/java</outputDirectorySuffix>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>generateProtobufScala</id>
            <activation>
                <file>
                    <exists>src/main/protobuf/generateScala.marker</exists>
                </file>
            </activation>

            <properties>
                <scalapbc.download.outputDirectory>${project.build.directory}</scalapbc.download.outputDirectory>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.googlecode.maven-download-plugin</groupId>
                        <artifactId>download-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>download-scalapbc</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>wget</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${scalapbc.download.outputDirectory}</outputDirectory>
                                    <url>https://github.com/scalapb/ScalaPB/releases/download/v${scalapb.version}/scalapbc-${scalapb.version}.zip</url>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unzip-scalapbc</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <unzip src="${scalapbc.download.outputDirectory}/scalapbc-${scalapb.version}.zip"
                                               dest="${scalapbc.download.outputDirectory}"/>
                                        <!-- Make scalapbc executable -->
                                        <chmod file="${scalapbc.download.outputDirectory}/scalapbc-${scalapb.version}/bin/scalapbc"
                                               perm="755"/>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>com.github.os72</groupId>
                        <artifactId>protoc-jar-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-protobuf-scala</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <type>scala</type>
                                    <outputDirectorySuffix>protobuf/scala</outputDirectorySuffix>
                                    <protocCommand>${scalapbc.download.outputDirectory}/scalapbc-${scalapb.version}/bin/scalapbc</protocCommand>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>prepareJacoco</id>
            <activation>
                <file>
                    <exists>src/test</exists>
                </file>
                <property>
                    <name>runReporting</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>jacoco-prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>jacoco-prepare-agent-integration</id>
                                <goals>
                                    <goal>prepare-agent-integration</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>runJacocoReport</id>
            <activation>
                <file>
                    <exists>jacocoReport.marker</exists>
                </file>
                <property>
                    <name>runReporting</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>jacoco-report-aggregate</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report-aggregate</goal>
                                </goals>
                                <configuration>
                                    <excludes>
                                        <!-- Exclude annotations -->
                                        <exclude>**/annotations/**/*</exclude>
                                        <!-- Exclude generated FreeBuilder beans -->
                                        <exclude>**/*_Builder*</exclude>
                                        <!-- Exclude generated AutoValue beans -->
                                        <exclude>**/*AutoValue_*</exclude>
                                        <!-- Exclude generated Protobuf beans -->
                                        <exclude>**/protobuf/java/**/*</exclude>
                                        <exclude>**/protobuf/scala/**/*</exclude>
                                    </excludes>
                                    <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- NOTE: Defined after runJacocoReport so that Jacoco execution happens first -->
        <profile>
            <id>runCoverallsReport</id>
            <activation>
                <file>
                    <exists>coverallsReport.marker</exists>
                </file>
                <property>
                    <name>runReporting</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.eluder.coveralls</groupId>
                        <artifactId>coveralls-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>coveralls-report</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <configuration>
                                    <scanForSources>true</scanForSources>
                                    <sourceDirectories>
                                        <!--
                                        We assume a multi-module project here where the coverallsReport.marker
                                        file is in a separate module. Since we are basing this on an aggregate
                                        Jacoco report, we'll need to go back to the root of the multi-module
                                        project in order to find all source files.
                                        -->
                                        <sourceDirectory>..</sourceDirectory>
                                    </sourceDirectories>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>scalaCompile</id>
            <activation>
                <file>
                    <exists>src/main/scala</exists>
                </file>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-scala-source</id>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/scala</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>scalaTestCompile</id>
            <activation>
                <file>
                    <exists>src/test/scala</exists>
                </file>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-scala-source</id>
                                <goals>
                                    <goal>add-test-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/test/scala</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>testCompile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
