<?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>
    <artifactId>kie-eap-distributions</artifactId>
    <groupId>org.kie</groupId>
    <version>6.2.0.CR2</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>kie-eap-distributions-bpms-webapp</artifactId>
  <name>KIE EAP - BPMS Webapp</name>
  <packaging>pom</packaging>

  <properties>
    <!-- The distribution name. -->
    <modules.distribution.name>bpms-webapp</modules.distribution.name>
    <!-- The output path where descriptors and assemblies will be placed. -->
    <modules.tmp.path>${project.build.directory}/generated</modules.tmp.path>
    <!--Note that the property module.add-jboss-all is set into the pom.xml for module org-jbpm-dashbuilder-webapp. -->
    <!-- <jboss-all-org.jbpm.dashbuilder>${modules.kie-wb.finalName}.war</jboss-all-org.jbpm.dashbuilder> -->
    <jboss-all-jbpm-dashbuilder>${project.artifactId}-${project.version}-kie-wb.war</jboss-all-jbpm-dashbuilder>
  </properties>

  <!-- The BPMS distributions dependencies. -->
  <dependencies>

    <!-- The kie-wb dynamic module definition. -->
    <dependency>
      <groupId>org.kie.modules</groupId>
      <artifactId>org-kie-wb-webapp</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
    </dependency>

    <!-- The jBPM Dashbuilder dynamic module definition. -->
    <dependency>
      <groupId>org.kie.modules</groupId>
      <artifactId>org-jbpm-dashbuilder-webapp</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
    </dependency>
    
  </dependencies>

  <build>

    <plugins>

      <!-- Create the module templates and assembly files. -->
      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>jboss-modules</artifactId>
        <version>${project.version}</version>
        <configuration>
          <distributionName>${modules.distribution.name}</distributionName>
          <!-- The output path for the assembly file. -->
          <outputPath>${modules.tmp.path}</outputPath>
          <!-- The static layer definition artifact. -->
          <staticLayerArtifact>
            <groupId>org.kie</groupId>
            <artifactId>kie-eap-distributions-bpms-layer</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
          </staticLayerArtifact>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>build-dynamic-modules</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Assembly the kie-wb and dashbuilder distributions. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <!-- Assembly the kie-wb WAR distribution. -->
          <execution>
            <id>assembly-kie-wb</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <!-- Assembly the kie-wb WAR. -->
                <descriptor>${modules.tmp.path}/dynamic-modules/${modules.distribution.name}/org-kie-wb-webapp-assembly.xml</descriptor>
                <descriptor>${modules.tmp.path}/dynamic-modules/${modules.distribution.name}/org-jbpm-dashbuilder-webapp-assembly.xml</descriptor>
              </descriptors>
              <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
              </archive>
              <appendAssemblyId>true</appendAssemblyId>
            </configuration>
          </execution>

        </executions>

      </plugin>

    </plugins>

  </build>

</project>