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

  <parent>
    <groupId>io.vertx</groupId>
    <artifactId>vertx-parent</artifactId>
    <version>19</version>
  </parent>

  <version>4.5.7</version>
  <artifactId>vertx-lang-groovy</artifactId>

  <name>Vert.x Groovy Language Support</name>

  <properties>
    <stack.version>4.5.7</stack.version>
    <asciidoc.dir>${project.basedir}/src/main/asciidoc</asciidoc.dir>
    <groovy.version>4.0.20</groovy.version>
    <log4j2.version>2.17.1</log4j2.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-dependencies</artifactId>
        <version>${stack.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <!-- What we need at runtime -->
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>${groovy.version}</version>
    </dependency>

    <!-- Not needed at runtime -->
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <scope>provided</scope>
      <classifier>sources</classifier>
    </dependency>
    <dependency>
      <groupId>org.mvel</groupId>
      <artifactId>mvel2</artifactId>
      <version>2.3.1.Final</version>
      <scope>provided</scope>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <classifier>tck-sources</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.1</version>
      <scope>test</scope>
    </dependency>

    <!-- Stack dependencies -->
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-codegen</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>

    <!-- What we need at runtime -->
    <dependency>
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy-json</artifactId>
      <version>${groovy.version}</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-service-proxy</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web-templ-freemarker</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-service-discovery</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-web-templ-freemarker</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.jayway.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <version>1.7.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.3.0</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <plugins>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <goals>
              <goal>addTestSources</goal>
              <goal>compileTests</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.bsc.maven</groupId>
        <artifactId>maven-processor-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <systemProperties>
            <java.util.logging.SimpleFormatter.format>%4$s: %3$s - %5$s %6$s%n</java.util.logging.SimpleFormatter.format>
            <mvel2.disable.jit>true</mvel2.disable.jit>
          </systemProperties>
        </configuration>
        <executions>
          <!-- Run the annotation processor on asciidoc sources and generate the docs -->
          <execution>
            <id>generate-doc</id>
            <goals>
              <goal>process</goal>
            </goals>
            <phase>process-classes</phase>
            <configuration>
              <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
              <processors>
                <processor>io.vertx.docgen.JavaDocGenProcessor</processor>
              </processors>
              <optionMap>
                <docgen.source>${asciidoc.dir}</docgen.source>
                <docgen.output>${project.build.directory}/asciidoc</docgen.output>
                <maven.groupId>${project.groupId}</maven.groupId>
                <maven.artifactId>${project.artifactId}</maven.artifactId>
                <maven.version>${project.version}</maven.version>
              </optionMap>
            </configuration>
          </execution>
          <execution>
            <id>generate-test-sources</id>
            <goals>
              <goal>process-test</goal>
            </goals>
            <phase>generate-test-sources</phase>
            <configuration>
              <processors>
                <processor>io.vertx.codegen.CodeGenProcessor</processor>
              </processors>
              <includes>
                <include>io/vertx/groovy/discovery/service/**</include>
              </includes>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.groovy</groupId>
            <artifactId>groovy</artifactId>
            <version>${groovy.version}</version>
          </dependency>
          <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-core</artifactId>
            <version>1.5.2</version>
            <exclusions>
              <exclusion>
                <groupId>io.reactivex</groupId>
                <artifactId>rxjava</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
          <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
          </dependency>
          <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j2.version}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j2.version}</version>
          </dependency>

          <!-- Transitive dependencies declared as optional in other modules, and needed for instance in docgen -->
          <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
            <version>1.0.0</version>
            <optional>true</optional>
          </dependency>
          <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-influx</artifactId>
            <version>1.0.0</version>
            <optional>true</optional>
          </dependency>
          <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-jmx</artifactId>
            <version>1.0.0</version>
            <optional>true</optional>
          </dependency>
          <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-graphite</artifactId>
            <version>1.0.0</version>
            <optional>true</optional>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-ext-resources</artifactId>
            <version>30</version>
          </dependency>
        </dependencies>
        <executions>
          <!-- Package docs -->
          <execution>
            <id>package-docs</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>true</attach>
              <formats>
                <format>zip</format>
              </formats>
              <descriptors>
                <descriptor>${project.basedir}/src/main/assembly/docs.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>

          <!-- Assemble docs so they can be rendered to HTML for previewing with the asciidoctor plugin -->
          <execution>
            <id>assemble-docs</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <formats>
                <format>dir</format>
              </formats>
              <attach>false</attach>
              <finalName>docs</finalName>
              <appendAssemblyId>false</appendAssemblyId>
              <descriptors>
                <descriptor>${project.basedir}/src/main/assembly/docs.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
