<!--

Before creating a pull request, the following goals should be executed locally:

* Executing tests: `mvn clean test`
* Executing doclint: `mvn javadoc:javadoc`

Tests & Code coverage:

* Executing benchmark assertions: `mvn clean test -Pbenchmark`
* Executing benchmarks (long running!): `mvn test -Pbenchmark -pl vavr-benchmark`
* Executing code coverage report: `mvn -P ci clean test jacoco:report`

We use these goals frequently to keep the dependencies and plugins up-to-date:

* Update version properties: `mvn versions:update-properties`
* Check for new plugin version: `mvn versions:display-plugin-updates`

Note: The maven build currently needs to be started from the vavr root dir
      because the code generators write to hard-coded relative directories.

-->
<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>
    <prerequisites>
        <maven>3.0.5</maven>
    </prerequisites>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
    </parent>
    <groupId>io.vavr</groupId>
    <artifactId>vavr-parent</artifactId>
    <version>0.9.0</version>
    <packaging>pom</packaging>
    <name>Vavr Parent</name>
    <description>Vavr (formerly called Javaslang) is an object-functional language extension to Java 8+.</description>
    <modules>
        <module>vavr</module>
        <module>vavr-match</module>
        <module>vavr-test</module>
    </modules>
    <url>http://vavr.io</url>
    <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>
        <connection>scm:git:git@github.com:vavr-io/vavr.git</connection>
        <developerConnection>scm:git:git@github.com:vavr-io/vavr.git</developerConnection>
        <url>git@github.com:vavr-io/vavr.git</url>
        <tag>v0.9.0</tag>
    </scm>
    <developers>
        <developer>
            <id>danieldietrich</id>
            <name>Daniel Dietrich</name>
            <email>cafebab3@gmail.com</email>
        </developer>
    </developers>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <assertj.core.version>3.6.2</assertj.core.version>
        <eclipse.lifecycle.mapping.version>1.0.0</eclipse.lifecycle.mapping.version>
        <java.version>1.8</java.version>
        <jmh.version>1.18</jmh.version>
        <junit.version>4.12</junit.version>
        <gwt.version>2.8.0</gwt.version>
        <maven.build-helper.version>1.12</maven.build-helper.version>
        <maven.bundle.version>3.2.0</maven.bundle.version>
        <maven.clean.version>3.0.0</maven.clean.version>
        <maven.install.version>2.5.2</maven.install.version>
        <maven.compiler.version>3.6.0</maven.compiler.version>
        <maven.deploy.version>2.8.2</maven.deploy.version>
        <maven.gpg.version>1.6</maven.gpg.version>
        <maven.jacoco.version>0.7.8</maven.jacoco.version>
        <maven.jar.version>3.0.2</maven.jar.version>
        <maven.javadoc.version>2.10.4</maven.javadoc.version>
        <maven.release.version>2.5.3</maven.release.version>
        <maven.versions.version>2.3</maven.versions.version>
        <maven.surefire.version>2.19.1</maven.surefire.version>
        <maven.source.version>3.0.1</maven.source.version>
        <maven.exec.version>1.5.0</maven.exec.version>
        <maven.gwt.plugin>1.0-rc-6</maven.gwt.plugin>
        <scala.maven.version>3.2.2</scala.maven.version>
        <scala.version>2.11.7</scala.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.core.version}</version>
            </dependency>
            <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-generator-annprocess</artifactId>
                <version>${jmh.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${maven.versions.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>${maven.install.version}</version>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven.source.version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                                <goal>test-jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven.clean.version}</version>
                    <executions>
                        <execution>
                            <id>clean-generated-sources</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                            <configuration>
                                <filesets>
                                    <fileset>
                                        <directory>${project.basedir}/src-gen</directory>
                                    </fileset>
                                </filesets>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>${scala.maven.version}</version>
                    <configuration>
                        <scalaVersion>${scala.version}</scalaVersion>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>script</goal>
                            </goals>
                            <configuration>
                                <scriptFile>${project.basedir}/generator/Generator.scala</scriptFile>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven.release.version}</version>
                    <configuration>
                        <!-- Simple tag names -->
                        <tagNameFormat>v@{project.version}</tagNameFormat>
                        <!-- Circumvent maven-gpg-plugin bug -->
                        <mavenExecutorId>forked-path</mavenExecutorId>
                        <useReleaseProfile>false</useReleaseProfile>
                        <!-- Honor arguments passed via command line -->
                        <arguments>${arguments} -Psonatype-oss-release</arguments>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${maven.build-helper.version}</version>
                    <executions>
                        <execution>
                            <id>add-source</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${project.basedir}/src-gen/main/java</source>
                                </sources>
                            </configuration>
                        </execution>
                        <execution>
                            <id>add-test-source</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>add-test-source</goal>
                            </goals>
                            <configuration>
                                <sources>
                                    <source>${project.basedir}/src-gen/test/java</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                        <compilerArgs>
                            <arg>-Werror</arg>
                            <arg>-Xlint:all</arg>
                            <!-- Workaround for JDK bug https://bugs.openjdk.java.net/browse/JDK-6999068 -->
                            <arg>-Xlint:-processing</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven.deploy.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.version}</version>
                    <configuration>
                        <skipIfEmpty>true</skipIfEmpty>
                        <archive>
                            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven.javadoc.version}</version>
                    <configuration>
                        <links>
                            <link>https://docs.oracle.com/javase/8/docs/api/</link>
                        </links>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.felix</groupId>
                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>${maven.bundle.version}</version>
                    <executions>
                        <execution>
                            <id>bundle-manifest</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>manifest</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.version}</version>
                    <configuration>
                        <parallel>all</parallel>
                        <threadCount>4</threadCount>
                        <reuseForks>true</reuseForks>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <!-- A profile for code coverage analysis in ci environments -->
        <profile>
            <id>ci</id>
            <activation>
                <property>
                    <name>env.CI</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${maven.jacoco.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- A profile for gpg-signing .jars when releasing -->
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <!-- Automatically set to true on mvn release:perform -->
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- A profile for eliminating eclipse m2e warnings -->
        <profile>
            <id>eclipse-m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.eclipse.m2e</groupId>
                            <artifactId>lifecycle-mapping</artifactId>
                            <version>${eclipse.lifecycle.mapping.version}</version>
                            <configuration>
                                <lifecycleMappingMetadata>
                                    <pluginExecutions>
                                        <!-- Elimate the eclipse warning 'maven-enforcer-plugin (goal "enforce")
                                            is ignored by m2e' -->
                                        <pluginExecution>
                                            <pluginExecutionFilter>
                                                <groupId>org.apache.maven.plugins</groupId>
                                                <artifactId>maven-enforcer-plugin</artifactId>
                                                <versionRange>[0,)</versionRange>
                                                <goals>
                                                    <goal>enforce</goal>
                                                </goals>
                                            </pluginExecutionFilter>
                                            <action>
                                                <ignore />
                                            </action>
                                        </pluginExecution>
                                        <pluginExecution>
                                            <pluginExecutionFilter>
                                                <groupId>org.apache.maven.plugins</groupId>
                                                <artifactId>maven-clean-plugin</artifactId>
                                                <versionRange>[0,)</versionRange>
                                                <goals>
                                                    <goal>clean</goal>
                                                </goals>
                                            </pluginExecutionFilter>
                                            <action>
                                                <ignore />
                                            </action>
                                        </pluginExecution>
                                        <pluginExecution>
                                            <pluginExecutionFilter>
                                                <groupId>net.alchim31.maven</groupId>
                                                <artifactId>scala-maven-plugin</artifactId>
                                                <versionRange>[0,)</versionRange>
                                                <goals>
                                                    <goal>script</goal>
                                                </goals>
                                            </pluginExecutionFilter>
                                            <action>
                                                <ignore />
                                            </action>
                                        </pluginExecution>
                                        <pluginExecution>
                                            <pluginExecutionFilter>
                                                <groupId>org.apache.felix</groupId>
                                                <artifactId>maven-bundle-plugin</artifactId>
                                                <versionRange>[0,)</versionRange>
                                                <goals>
                                                    <goal>manifest</goal>
                                                </goals>
                                            </pluginExecutionFilter>
                                            <action>
                                                <ignore />
                                            </action>
                                        </pluginExecution>
                                    </pluginExecutions>
                                </lifecycleMappingMetadata>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <!-- A profile for running the benchmarks -->
        <profile>
            <id>benchmark</id>
            <modules>
                <module>vavr</module>
                <module>vavr-benchmark</module>
                <module>vavr-match</module>
                <module>vavr-test</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>${maven.exec.version}</version>
                        <executions>
                            <execution>
                                <phase>test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <classpathScope>test</classpathScope>
                                    <executable>java</executable>
                                    <arguments>
                                        <argument>-classpath</argument>
                                        <classpath />
                                        <argument>vavr.JmhRunner</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>${maven.surefire.version}</version>
                            <configuration>
                                <!-- Fixes "Unable to acquire the JMH lock" error -->
                                <parallel>none</parallel>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
