<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.codehaus</groupId>
    <artifactId>codehaus-parent</artifactId>
    <version>4</version>
  </parent>

  <groupId>org.milyn.edi</groupId>
  <artifactId>unedifact-gen</artifactId>
  <packaging>pom</packaging>
  <version>1.6</version>
  <name>Smooks EDI - UN/EDIFACT - Bindings Generation</name>
  <description>
    Generates Java bindings for UN/EDIFACT messages.
  </description>

  <properties>
    <maven.compiler.source>1.5</maven.compiler.source>
    <maven.compiler.target>1.5</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <smooks.version>1.6</smooks.version>
  </properties>

  <modules>
    <module>d93a</module>
    <module>d94a</module>
    <module>d94b</module>
    <module>d95a</module>
    <module>d95b</module>
    <module>d96a</module>
    <module>d96b</module>
    <module>d97a</module>
    <module>d97b</module>
    <module>d98a</module>
    <module>d98b</module>
    <module>d99a</module>
    <module>d99b</module>
    <module>d00a</module>
    <module>d00b</module>
    <module>d01a</module>
    <module>d01b</module>
    <module>d01c</module>
    <module>d02a</module>
    <module>d02b</module>
    <module>d03a</module>
    <module>d03b</module>
    <module>d04a</module>
    <module>d04b</module>
    <module>d05a</module>
    <module>d05b</module>
    <module>d06a</module>
    <module>d06b</module>
    <module>d07a</module>
    <module>d07b</module>
    <module>d08a</module>
    <module>d08b</module>
    <module>d09a</module>
    <module>d09b</module>
    <module>d10a</module>
    <module>d10b</module>
    <module>d11a</module>
    <module>d11b</module>
    <module>d12a</module>
    <module>d12b</module>
    <module>d13a</module>
    <module>d13b</module>
    <module>d14a</module>
    <module>d14b</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.milyn</groupId>
        <artifactId>milyn-smooks-edi</artifactId>
        <version>${smooks.version}</version>
      </dependency>
      <dependency>
        <groupId>org.milyn</groupId>
        <artifactId>milyn-smooks-ect</artifactId>
        <version>${smooks.version}</version>
      </dependency>
      <dependency>
        <groupId>org.milyn</groupId>
        <artifactId>milyn-smooks-ejc</artifactId>
        <version>${smooks.version}</version>
      </dependency>
      <dependency>
        <groupId>org.milyn</groupId>
        <artifactId>testres</artifactId>
        <version>${smooks.version}</version>
      </dependency>

      <dependency>
        <groupId>org.eclipse.xsd</groupId>
        <artifactId>org.eclipse.xsd</artifactId>
        <version>2.7.0-v20110606-0949</version>
      </dependency>

      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
      </dependency>

      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.milyn</groupId>
      <artifactId>milyn-smooks-edi</artifactId>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>2.4</version>
        </plugin>

        <plugin>
          <groupId>org.milyn</groupId>
          <artifactId>maven-ect-plugin</artifactId>
          <version>${smooks.version}</version>
          <dependencies>
            <!--
              The following dependencies are required by the plugin. However,
              the plugin POM contains versions for these dependencies that
              are not available in Maven Central. Therefore, the dependency
              versions are being overridden here to force the build process to
              work.
            -->
            <dependency>
              <groupId>org.eclipse.emf</groupId>
              <artifactId>org.eclipse.emf.common</artifactId>
              <version>2.6.0.v20100614-1136</version>
            </dependency>
            <dependency>
              <groupId>org.eclipse.emf</groupId>
              <artifactId>org.eclipse.emf.ecore</artifactId>
              <version>2.7.0-v20110605-0747</version>
            </dependency>
            <dependency>
              <groupId>org.eclipse.xsd</groupId>
              <artifactId>org.eclipse.xsd</artifactId>
              <version>2.7.0-v20110606-0949</version>
            </dependency>

            <!--
              The following version of the dependency is the lowest available in
              Maven Central. Changing to a later version may cause build
              failures.
            -->
            <dependency>
              <groupId>org.jfrog.maven.annomojo</groupId>
              <artifactId>maven-plugin-anno</artifactId>
              <version>1.3.1</version>
            </dependency>

            <!--
              The following dependency has been included because it has a
              transitive dependency on the Eclipse XSD dependency, whose
              specified version is not available in Maven Central, causing
              build failures.
            -->
            <dependency>
              <groupId>org.milyn</groupId>
              <artifactId>milyn-smooks-ect</artifactId>
              <version>${smooks.version}</version>
              <exclusions>
                <exclusion>
                  <groupId>org.eclipse.xsd</groupId>
                  <artifactId>org.eclipse.xsd</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <goals>
                <goal>generate</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.milyn</groupId>
          <artifactId>maven-ejc-plugin</artifactId>
          <version>${smooks.version}</version>
          <dependencies>
            <!--
              The following dependencies are required by the plugin. However,
              the plugin POM contains versions for these dependencies that
              are not available in Maven Central. Therefore, the dependency
              versions are being overridden here to force the build process to
              work.
            -->
            <dependency>
              <groupId>org.eclipse.xsd</groupId>
              <artifactId>org.eclipse.xsd</artifactId>
              <version>2.7.0-v20110606-0949</version>
            </dependency>

            <!--
              The following version of the dependency is the lowest available in
              Maven Central. Changing to a later version may cause build
              failures.
            -->
            <dependency>
              <groupId>org.jfrog.maven.annomojo</groupId>
              <artifactId>maven-plugin-anno</artifactId>
              <version>1.3.1</version>
            </dependency>

            <!--
              The following dependency has been included because it has a
              transitive dependency on the Eclipse XSD dependency, whose
              specified version is not available in Maven Central, causing
              build failures.
            -->
            <dependency>
              <groupId>org.milyn</groupId>
              <artifactId>milyn-smooks-ejc</artifactId>
              <version>${smooks.version}</version>
              <exclusions>
                <exclusion>
                  <groupId>org.eclipse.xsd</groupId>
                  <artifactId>org.eclipse.xsd</artifactId>
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <goals>
                <goal>generate</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.0.1</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>$(maven-symbolicname);singleton:=true</Bundle-SymbolicName>
            <Fragment-Host>org.milyn.smooks.osgi;bundle-version=${smooks.osgi.version}</Fragment-Host>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>regex-property</id>
            <goals>
              <goal>regex-property</goal>
            </goals>
            <configuration>
              <name>smooks.osgi.version</name>
              <value>${project.version}</value>
              <regex>-SNAPSHOT</regex>
              <replacement>.SNAPSHOT</replacement>
              <failIfNoMatch>false</failIfNoMatch>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <directory>src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!--
            Signs Maven artifacts. This is a mandatory requirement for
            publishing Maven artifacts to Maven Central using the open-source
            Nexus repository operated by Sonatype.

            See details for the Nexus Staging plugin below.
          -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!--
            Generates a JAR file containing Javadocs for the generated classes.
            This is a mandatory requirement for publishing Maven artifacts to
            Maven Central using the open-source Nexus repository operated by
            Sonatype.

            See details for the Nexus Staging plugin below.
          -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.4</version>
            <executions>
              <execution>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!--
            Generates a JAR file containing source code for the generated
            classes. This is a mandatory requirement for publishing Maven
            artifacts to Maven Central using the open-source Nexus repository
            operated by Sonatype.

            See details for the Nexus Staging plugin below.
          -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!--
            Skips running tests as part of the deployment process.
          -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.10</version>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>

          <!--
            Uploads Maven artifacts to the open-source Nexus repository
            operated by Sonatype. Artifacts are uploaded to a staging area on
            the Sonatype Nexus repository, where they need to be reviewed for
            completeness and correctness through the Nexus web interface. Once
            artifacts have been reviewed and found to be accurate, they can be
            approved for deployment to Maven Central. Sonatype automatically
            uploads approved artifacts to Maven Central (usually within a few
            hours).
          -->
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.5.1</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <pluginRepositories>
    <pluginRepository>
      <id>jfrog-plugins</id>
      <url>http://repo.jfrog.org/artifactory/plugins-releases</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <repositories>
    <repository>
      <id>smooks</id>
      <url>http://smooks.org/maven2/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>
</project>
