<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2011-2014 The original author or authors
  ~
  ~  All rights reserved. This program and the accompanying materials
  ~  are made available under the terms of the Eclipse Public License v1.0
  ~  and Apache License v2.0 which accompanies this distribution.
  ~
  ~      The Eclipse Public License is available at
  ~      http://www.eclipse.org/legal/epl-v10.html
  ~
  ~      The Apache License v2.0 is available at
  ~      http://www.opensource.org/licenses/apache2.0.php
  ~
  ~  You may elect to redistribute this code under either of these licenses.
  -->

<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>io.vertx</groupId>
    <artifactId>vertx-parent</artifactId>
    <version>3.0.0-dev_preview1</version>
  </parent>

  <artifactId>vertx-mongo-service</artifactId>
  <version>3.0.0-dev_preview1</version>

  <name>Vert.x Mongo Service</name>

  <properties>
    <vertx.version>3.0.0-dev_preview1</vertx.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <version>${vertx.version}</version>
    </dependency>
    <dependency>
      <groupId>org.mongodb</groupId>
      <artifactId>driver-async</artifactId>
      <version>3.0.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-mongo-embedded-db</artifactId>
      <version>${vertx.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-service-proxy</artifactId>
      <version>${vertx.version}</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-groovy</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <version>2.3.6</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-lang-js</artifactId>
      <version>${vertx.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <version>${vertx.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-service-factory</artifactId>
      <version>${vertx.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
      <version>4.11</version>
    </dependency>
  </dependencies>

  <build>

    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.9.1</version>
        </plugin>

        <!-- Configure the execution of the compiler to execute the codegen processor -->
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <executions>
            <execution>
              <id>default-compile</id>
              <configuration>
                <annotationProcessors>
                  <annotationProcessor>io.vertx.codegen.CodeGenProcessor</annotationProcessor>
                </annotationProcessors>
                <generatedSourcesDirectory>${project.basedir}/src/main/generated</generatedSourcesDirectory>
                <compilerArgs>
                  <arg>-AoutputDirectory=${project.basedir}/src/main</arg>
                </compilerArgs>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <!-- Define an assembly execution for packaging the vertx service that can be reused
             by children modules -->
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.4.1</version>
          <dependencies>
            <dependency>
              <groupId>io.vertx</groupId>
              <artifactId>vertx-service-factory</artifactId>
              <version>${project.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>package-vertx-service</id>
              <goals>
                <goal>single</goal>
              </goals>
              <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptorRefs>
                  <descriptorRef>vertx-service</descriptorRef>
                </descriptorRefs>
              </configuration>
              <phase>package</phase>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- Copy resources after compilation phase as we generate JS in src/main/resources -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>default-resources</id>
            <phase>process-classes</phase>
          </execution>
        </executions>
      </plugin>
      <!-- Compile Groovy -->
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Have .groovy files in sources-jar -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-groovy-source</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/main/groovy</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
          <systemPropertyVariables>
            <vertx.test.timeout>60</vertx.test.timeout>
            <io.netty.leakDetectionLevel>PARANOID</io.netty.leakDetectionLevel>
          </systemPropertyVariables>
          <argLine>-server -Xms128m -Xmx1024m -XX:NewRatio=2</argLine>
          <excludes>
            <exclude>**/ScratchPad.java</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
