<?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>org.kie</groupId>
    <artifactId>kie-docs</artifactId>
    <version>6.4.0.CR2</version>
  </parent>

  <groupId>org.jbpm</groupId>
  <artifactId>jbpm-docs</artifactId>
  <packaging>jdocbook</packaging>

  <name>KIE :: Documentation :: jBPM</name>
  <description>jBPM Documentation</description>

  <properties>
    <examples.dir>${basedir}/src/main/docbook/en-US/code/</examples.dir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-docs-code</artifactId>
      <classifier>examples</classifier>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <!-- so that jbpm-asciidocs can inject this content -->
        <directory>src/main/docbook/en-US/</directory>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <executions>
          <execution>
            <id>unpacked-generated-files</id>
            <phase>clean</phase>
            <goals>
              <goal>clean</goal>
            </goals>
            <configuration>
              <filesets>
                <fileset>
                  <directory>${examples.dir}</directory>
                </fileset>
              </filesets>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-cmd-sources</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.kie</groupId>
                  <artifactId>kie-docs-code</artifactId>
                  <classifier>examples</classifier>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${examples.dir}</outputDirectory>
                  <includes>**/*.java</includes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
