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

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

  <modelVersion>4.0.0</modelVersion>

  <artifactId>vertx-codegen</artifactId>
  <version>3.4.2</version>

  <properties>
    <asciidoc.dir>${project.basedir}/src/main/asciidoc</asciidoc.dir>
    <stack.version>3.4.2</stack.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>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-docgen</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>2.7.4</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.7.4</version>
    </dependency>
    <dependency>
      <groupId>org.mvel</groupId>
      <artifactId>mvel2</artifactId>
      <version>2.2.8.Final</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <executions>
            <execution>
              <id>default-compile</id>
              <configuration>
                <annotationProcessors>
                  <annotationProcessor>io.vertx.docgen.JavaDocGenProcessor</annotationProcessor>
                </annotationProcessors>
                <compilerArgs>
                  <arg>-Adocgen.output=${asciidoc.dir}/java</arg>
                </compilerArgs>
                <generatedSourcesDirectory>${generated.dir}</generatedSourcesDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <executions>
            <execution>
              <id>default-jar</id>
              <configuration>
                <excludes>
                  <exclude>io/vertx/core/**</exclude>
                  <exclude>io/vertx/codegen/testmodel/**</exclude>
                  <exclude>com/acme/**</exclude>
                </excludes>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <additionalClasspathElements>
              <additionalClasspathElement>${project.build.testSourceDirectory}</additionalClasspathElement>
              <additionalClasspathElement>${project.basedir}/src/test/testgen1</additionalClasspathElement>
              <additionalClasspathElement>${project.basedir}/src/test/testgen2</additionalClasspathElement>
              <additionalClasspathElement>${project.basedir}/src/test/testgen3</additionalClasspathElement>
              <additionalClasspathElement>${project.basedir}/src/test/testgen4</additionalClasspathElement>
              <additionalClasspathElement>${project.basedir}/src/test/testgen5</additionalClasspathElement>
            </additionalClasspathElements>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <configuration>
            <excludes>
              <exclude>io/vertx/core/**</exclude>
              <exclude>examples/**</exclude>
            </excludes>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-example-source</id>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/examples/java</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-tck-source</id>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${basedir}/src/tck/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>package</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>true</attach>
              <appendAssemblyId>false</appendAssemblyId>
              <archive>
                    <manifestFile>${project.build.directory}/classes/META-INF/MANIFEST.MF</manifestFile>
                </archive>
              <descriptors>
                <descriptor>src/main/assembly/jar.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
          <execution>
            <id>package-others</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>true</attach>
              <descriptors>
                <descriptor>src/main/assembly/processor.xml</descriptor>
                <descriptor>src/main/assembly/tck.xml</descriptor>
                <descriptor>src/main/assembly/tck-sources.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
		<groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>default-bnd-process</id>
            <goals>
              <goal>bnd-process</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <bnd><![CDATA[
          Import-Package: \
          		  org.mvel2*;resolution:=optional, \
          		  io.vertx.core, \
          		  io.vertx.core.buffer, \
                  *
                -exportcontents: !*impl, !examples, *
          ]]></bnd>
        </configuration>
  	  </plugin>
  	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-jar-plugin</artifactId>
	    <configuration>
	        <archive>
	            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
	        </archive>
	    </configuration>
	  </plugin>
    </plugins>
  </build>
</project>
