<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.devzendo</groupId>
    <artifactId>group-parent-scala</artifactId>
    <version>1.0.6</version>
    <packaging>pom</packaging>
    <name>group-parent-scala</name>

    <description>The parent of all DevZendo.org Maven Scala projects
        (Apache License v2) 2008-2022 Matt Gumbley, DevZendo.org
    </description>

    <url>https://devzendo.github.io/dev/commons/</url>

    <organization>
        <name>DevZendo.org</name>
        <url>http://devzendo.org/</url>
    </organization>

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

    <scm>
        <url>https://github.com/devzendo/group-parent-scala.git</url>
        <connection>scm:git:https://github.com/devzendo/group-parent-scala.git</connection>
        <developerConnection>scm:git:https://github.com/devzendo/group-parent-scala.git</developerConnection>
        <tag>group-parent-scala-1.0.6</tag>
    </scm>

    <developers>
        <developer>
            <id>matt.gumbley</id>
            <name>Matt Gumbley</name>
            <email>matt.gumbley@devzendo.org</email>
        </developer>
    </developers>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <scala.version>2.12.5</scala.version>
        <scalatest.scala.version>2.12</scalatest.scala.version> <!-- version 2.2.6 is current -->
        <scalacheck.scala.version>2.12</scalacheck.scala.version> <!-- version 1.12.2 is current -->
        <parser.combinators.scala.version>2.12</parser.combinators.scala.version> <!-- version 1.0.3 is current -->
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>

            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.3.2</version>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <scalaVersion>${scala.version}</scalaVersion>
                            <sendJavaToScalac>true</sendJavaToScalac>
                            <args>
                                <arg>-deprecation</arg>
                                <arg>-feature</arg>
                                <!-- Would like to enable -Xexperimental for SAM types https://herringtondarkholme.github.io/2015/01/24/scala-sam/
                                     but doing so breaks ScalaTest's use of eq/any argument matchers -->
                                <arg>-language:implicitConversions</arg>
                            </args>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <scalaVersion>${scala.version}</scalaVersion>
                            <sendJavaToScalac>true</sendJavaToScalac>
                            <args>
                                <arg>-deprecation</arg>
                                <arg>-feature</arg>
                                <!-- Would like to enable -Xexperimental for SAM types https://herringtondarkholme.github.io/2015/01/24/scala-sam/
                                     but doing so breaks ScalaTest's use of eq/any argument matchers -->
                                <arg>-language:implicitConversions</arg>
                            </args>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-package</id>
                        <phase>package</phase>
                        <goals>
                            <goal>doc-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--
            I added this at one stage, but it breaks the compilation of tests if they are written in scala
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.10</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/scala</source>
                                <source>src/test/scala</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            -->

            <!-- The maven-compiler-plugin is getting invoked anyway, even if
                 this isn't included, but we need to set our source version,
                 mostly to help IDEs. -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>${maven.compiler.target}</source>
                    <target>${maven.compiler.target}</target>
                    <compilerArgs>
                        <arg>-Xlint:unchecked</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <skipIfEmpty>true</skipIfEmpty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <!-- The following plugins are only activated when building on the DevZendo.org CI server -->
    <profiles>
        <profile>
            <id>ci</id>

            <reporting>
                <plugins>
                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <version>3.3.2</version>
                        <configuration>
                            <scalaVersion>${scala.version}</scalaVersion>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-report-plugin</artifactId>
                        <version>2.20.1</version>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>2.9</version>
                    </plugin>
                </plugins>
            </reporting>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <executable>gpg2</executable>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>sonatype-nexus-staging</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest_${scalatest.scala.version}</artifactId>
                <version>3.0.5</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.scalacheck</groupId>
                <artifactId>scalacheck_${scalacheck.scala.version}</artifactId>
                <version>1.12.6</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.devzendo</groupId>
                <artifactId>scalacheck-contrib_${scalacheck.scala.version}</artifactId>
                <version>1.0.3</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.scala-lang.modules</groupId>
                <artifactId>scala-parser-combinators_${parser.combinators.scala.version}</artifactId>
                <version>1.0.5</version>
                <!-- This requires Scala 2.11.8, and earlier versions require earlier libraries,
                     so exclude its library dependency since we're on 2.11.7 for now. -->
                <exclusions>
                    <exclusion>
                        <groupId>org.scala-lang</groupId>
                        <artifactId>scala-library</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
