<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>com.github.pjgg</groupId>
    <artifactId>radioactiveMongoTemplate</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>RadioactiveMongoTemplate</name>
    <description>Reactive mongo DAO</description>
    <url>https://github.com/pjgg/radioactiveMongoTemplate</url>
    <developers>
        <developer>
            <id>pjgg</id>
            <name>Pablo Gonzalez</name>
            <roles>
                <role>developer</role>
            </roles>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>Happy coding!</comments>
        </license>
    </licenses>

    <prerequisites>
        <maven>3.0.4</maven>
    </prerequisites>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jmh.version>1.11.3</jmh.version>
        <jmh.generator>default</jmh.generator>  <!-- or "asm", or "reflection" -->
        <javac.target>1.8</javac.target>
        <uberjar.name>benchmarks</uberjar.name>
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.7</scala.version>
        <dockerFilePath>${project.build.testOutputDirectory}/docker/</dockerFilePath>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>${jmh.version}</version>
        </dependency>

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

        <!-- acceptance test-->

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <scope>test</scope>
            <version>1.0.5</version>
            <exclusions>
                <exclusion>
                    <groupId>com.thoughtworks.xstream</groupId>
                    <artifactId>xstream</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.googlecode.java-diff-utils</groupId>
                    <artifactId>diffutils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-scala_2.11</artifactId>
            <scope>test</scope>
            <version>1.2.4</version>
        </dependency>

        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <scope>test</scope>
            <version>1.2.4</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>${scala.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_2.11</artifactId>
            <version>2.2.4</version>
            <scope>test</scope>
        </dependency>


        <!-- Mongo -->
        <dependency>
            <groupId>org.reactivemongo</groupId>
            <artifactId>reactivemongo_${scala.binary.version}</artifactId>
            <version>0.11.10</version>
        </dependency>

        <!--logs -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.3</version>
        </dependency>

        <!-- properties -->
        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.10</version>
        </dependency>

        <dependency>
            <groupId>com.typesafe</groupId>
            <artifactId>config</artifactId>
            <version>1.3.0</version>
        </dependency>

        <!-- scalaz -->
        <dependency>
            <groupId>org.scalaz</groupId>
            <artifactId>scalaz-core_2.11</artifactId>
            <version>7.2.2</version>
        </dependency>

        <!--JsonParser-->

        <dependency>
            <groupId>com.github.limansky</groupId>
            <artifactId>mongoquery-reactive_2.11</artifactId>
            <version>0.4</version>
        </dependency>

        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-native_2.11</artifactId>
            <version>3.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-jackson_2.11</artifactId>
            <version>3.3.0</version>
        </dependency>

        <!-- coverage -->
        <dependency>
            <groupId>org.scoverage</groupId>
            <artifactId>maven-scoverage-plugin</artifactId>
            <version>0.99.10</version>
        </dependency>

        <!-- Release to maven Central-->
        <dependency>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.7</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <type>maven-plugin</type>
        </dependency>

    </dependencies>


    <profiles>

        <profile>
            <id>performance</id>

            <build>
                <plugins>

                    <!--
                        1. Add source directories for both scalac and javac.
                    -->

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>${project.basedir}/src/main/scala</source>
                                        <source>${project.basedir}/src/test/scala</source>
                                        <source>${project.basedir}/target/generated-sources/jmh</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!--
                        2. Compile Scala sources
                      -->

                    <plugin>
                        <groupId>net.alchim31.maven</groupId>
                        <artifactId>scala-maven-plugin</artifactId>
                        <version>3.2.2</version>
                        <configuration>
                            <recompileMode>incremental</recompileMode>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!--
                        3. Invoke JMH generators to produce benchmark code
                    -->

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.4.0</version>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <includePluginDependencies>true</includePluginDependencies>
                                    <mainClass>org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator</mainClass>
                                    <arguments>
                                        <argument>${project.basedir}/target/classes/</argument>
                                        <argument>${project.basedir}/target/generated-sources/jmh/</argument>
                                        <argument>${project.basedir}/target/classes/</argument>
                                        <argument>${jmh.generator}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.openjdk.jmh</groupId>
                                <artifactId>jmh-generator-bytecode</artifactId>
                                <version>${jmh.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>

                    <!--
                        4. Compile JMH generated code.
                     -->

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.1</version>
                        <configuration>
                            <compilerVersion>1.8</compilerVersion>
                            <source>1.8</source>
                            <target>1.8</target>
                            <compilerArgument>-proc:none</compilerArgument>
                        </configuration>
                    </plugin>

                    <!--
                        5. Package all the dependencies into the JAR
                     -->

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>2.2</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <finalName>myBechmark</finalName>
                                    <transformers>
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>org.openjdk.jmh.Main</mainClass>
                                        </transformer>
                                    </transformers>
                                    <filters>
                                        <filter>

                                            <artifact>*:*</artifact>
                                            <excludes>
                                                <exclude>META-INF/*.SF</exclude>
                                                <exclude>META-INF/*.DSA</exclude>
                                                <exclude>META-INF/*.RSA</exclude>
                                            </excludes>
                                        </filter>
                                    </filters>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>

        </profile>

        <profile>
            <id>acceptance</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <repoToken>fakeToken</repoToken>
                <travisJobId>fakeTravisJobId</travisJobId>
            </properties>
            <build>
                <testResources>
                    <testResource>
                        <directory>src/test/resources</directory>
                        <filtering>true</filtering>
                    </testResource>
                </testResources>

                <plugins>
                    <plugin>
                        <groupId>org.scala-tools</groupId>
                        <artifactId>maven-scala-plugin</artifactId>
                        <version>2.15.2</version>
                        <configuration>
                            <!--encoding>UTF-8</encoding-->
                            <excludes>
                                <exclude>**/*.java</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>add-source</goal>
                                    <goal>compile</goal>
                                    <goal>testCompile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.eluder.coveralls</groupId>
                        <artifactId>coveralls-maven-plugin</artifactId>
                        <version>4.1.0</version>
                        <configuration>
                            <repoToken>${repoToken}</repoToken>
                            <sourceDirectories>
                                <sourceDirectory>src/main/scala</sourceDirectory>
                            </sourceDirectories>
                            <coberturaReports>
                                <coberturaReport>
                                    ${basedir}/target/coverage.xml
                                </coberturaReport>
                            </coberturaReports>
                            <sourceEncoding>UTF-8</sourceEncoding>
                            <serviceName>travis-ci</serviceName>
                            <serviceJobId>${travisJobId} </serviceJobId>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>cobertura-maven-plugin</artifactId>
                        <version>2.7</version>
                        <configuration>
                            <check>false</check>
                            <format>xml</format>
                            <maxmem>256m</maxmem>
                            <!-- aggregated reports for multi-module projects -->
                            <aggregate>true</aggregate>
                            <outputDirectory>${basedir}/target</outputDirectory>
                        </configuration>
                    </plugin>

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

                </plugins>
            </build>

            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.scoverage</groupId>
                        <artifactId>scoverage-maven-plugin</artifactId>
                        <version>1.1.0</version>
                        <configuration>
                            <highlighting>true</highlighting>
                        </configuration>
                        <reportSets>
                            <reportSet>
                                <reports>
                                    <report>integration-report</report> <!-- select only one report from: report, integration-report and report-only reporters -->
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                </plugins>
            </reporting>

        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>


                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>2.3.2</version>
                    </plugin>



                    <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>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>

    </profiles>

    <scm>
        <connection>scm:git:https://github.com/pjgg/radioactiveMongoTemplate.git</connection>
        <developerConnection>scm:git@github.com:pjgg/radioactiveMongoTemplate.git</developerConnection>
        <url>https://github.com/pjgg/radioactiveMongoTemplate</url>
        <tag>HEAD</tag>
    </scm>

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


</project>
