<?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>
  <artifactId>edi-schemas</artifactId>
  <packaging>jar</packaging>
  <name>Mule EDI Schemas</name>

  <parent>
    <groupId>org.mule.edi</groupId>
    <artifactId>edi</artifactId>
    <version>1.0.1</version>
    <relativePath>..</relativePath>
  </parent>

  <dependencies>
    <dependency>
      <groupId>org.mule.edi</groupId>
      <artifactId>edi-parser</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_${base.scala.version}</artifactId>
      <version>2.2.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-compiler</artifactId>
      <version>${scala.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${scala.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>scala-compile-first</id>
            <phase>process-resources</phase>
            <goals>
              <goal>add-source</goal>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>scala-test-compile</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
          <execution>
            <id>build-x12-schemas</id>
            <phase>prepare-package</phase>
            <configuration>
              <recompileMode>incremental</recompileMode>
              <source>${jdk.version}</source>
              <target>${jdk.version}</target>
              <launchers>
                <launcher>
                  <mainClass>com.anypoint.df.edi.schema.convert.X12TablesConverter</mainClass>
                  <args>
                    <arg>${basedir}/src/main/build-resources/x12</arg>
                    <arg>${project.build.directory}/schemas/x12</arg>
                  </args>
                  <jvmArgs>
                    <jvmArg>-Xms256m</jvmArg>
                    <jvmArg>-Xmx256m</jvmArg>
                  </jvmArgs>
                </launcher>
              </launchers>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>build-edifact-schemas</id>
            <phase>prepare-package</phase>
            <configuration>
              <recompileMode>incremental</recompileMode>
              <source>${jdk.version}</source>
              <target>${jdk.version}</target>
              <launchers>
                <launcher>
                  <mainClass>com.anypoint.df.edi.schema.convert.EdifactTablesConverter</mainClass>
                  <args>
                    <arg>${basedir}/src/main/build-resources/edifact</arg>
                    <arg>${project.build.directory}/schemas/edifact</arg>
                  </args>
                  <jvmArgs>
                    <jvmArg>-Xms256m</jvmArg>
                    <jvmArg>-Xmx256m</jvmArg>
                  </jvmArgs>
                </launcher>
              </launchers>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>build-hl7-schemas</id>
            <phase>prepare-package</phase>
            <configuration>
              <recompileMode>incremental</recompileMode>
              <source>${jdk.version}</source>
              <target>${jdk.version}</target>
              <launchers>
                <launcher>
                  <mainClass>com.anypoint.df.edi.schema.convert.HL7TablesConverter</mainClass>
                  <args>
                    <arg>${basedir}/src/main/build-resources/hl7</arg>
                    <arg>${project.build.directory}/schemas/hl7</arg>
                  </args>
                  <jvmArgs>
                    <jvmArg>-Xms256m</jvmArg>
                    <jvmArg>-Xmx256m</jvmArg>
                  </jvmArgs>
                </launcher>
              </launchers>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest-maven-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
          <junitxml>.</junitxml>
          <filereports>schema-tests.txt</filereports>
        </configuration>
        <executions>
          <execution>
            <id>test</id>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <classesDirectory>${project.build.directory}/schemas</classesDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
