<?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.kie</groupId>
    <artifactId>kie-wb</artifactId>
    <version>6.3.0.Final</version>
  </parent>

  <artifactId>kie-wb-distribution-wars</artifactId>
  <packaging>pom</packaging>

  <name>KIE Workbench - Distribution Wars</name>
  <description>This module builds the download wars for different application servers.</description>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.codehaus.woodstox</groupId>
        <artifactId>stax2-api</artifactId>
        <version>3.1.1</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Internal dependencies -->
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-wb-webapp</artifactId>
      <type>war</type>
    </dependency>

    <!-- External dependencies -->
    <!--tomcat-->
    <dependency>
      <groupId>ch.qos.cal10n</groupId>
      <artifactId>cal10n-api</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.spec.javax.annotation</groupId>
      <artifactId>jboss-annotations-api_1.1_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.interceptor</groupId>
      <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.servlet.jstl</groupId>
      <artifactId>jboss-jstl-api_1.2_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.jms</groupId>
      <artifactId>jboss-jms-api_1.1_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.xml.ws</groupId>
      <artifactId>jboss-jaxws-api_2.2_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.ws.rs</groupId>
      <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.xml.bind</groupId>
      <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.ejb</groupId>
      <artifactId>jboss-ejb-api_3.1_spec</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>jaxrs-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-cdi</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson-provider</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxb-provider</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.weld</groupId>
      <artifactId>weld-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.weld</groupId>
      <artifactId>weld-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.weld.servlet</groupId>
      <artifactId>weld-servlet-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.weld</groupId>
      <artifactId>weld-spi</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.weld.se</groupId>
      <artifactId>weld-se-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>

    <dependency>
      <groupId>net.jcip</groupId>
      <artifactId>jcip-annotations</artifactId>
    </dependency>

    <dependency>
      <groupId>xalan</groupId>
      <artifactId>xalan</artifactId>
    </dependency>
    <dependency>
      <groupId>xalan</groupId>
      <artifactId>serializer</artifactId>
    </dependency>
    <dependency>
      <groupId>xerces</groupId>
      <artifactId>xercesImpl</artifactId>
    </dependency>
    <dependency>
      <groupId>xml-resolver</groupId>
      <artifactId>xml-resolver</artifactId>
    </dependency>

    <!--weblogic & was-->
    <dependency>
      <groupId>antlr</groupId>
      <artifactId>antlr</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-bindings-soap</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-bindings-xml</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-databinding-jaxb</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxws</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-simple</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-ws-addr</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-ws-policy</artifactId>
    </dependency>
    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-xjc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.logging</groupId>
      <artifactId>jboss-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.neethi</groupId>
      <artifactId>neethi</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-ext</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.woodstox</groupId>
      <artifactId>woodstox-core-asl</artifactId>
    </dependency>
    <dependency>
      <groupId>wsdl4j</groupId>
      <artifactId>wsdl4j</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate.common</groupId>
      <artifactId>hibernate-commons-annotations</artifactId>
    </dependency>

    <!-- for tomcat and RestEasy -->
    <dependency>
      <groupId>org.scannotation</groupId>
      <artifactId>scannotation</artifactId>
    </dependency>

    <!-- For WAS8 shading -->
    <dependency>
      <groupId>org.sonatype.sisu</groupId>
      <artifactId>sisu-inject-bean</artifactId>
    </dependency>
    <!-- WAS8 uses JUL, so just bind slf4j to that -->
    <!-- use ejb timer service for WAS as otherwise there is not access to UserTransaction or TransactionSyncRegistry -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-services-ejb-timer</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.woodstox</groupId>
      <artifactId>stax2-api</artifactId>
    </dependency>

    <!-- Errai integration that supports CDI 1.0 -->
    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-weld-integration</artifactId>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <!-- special handling for WAS8.5 as sisu-inject-bean:2.2.3 contains javax.inject classes which conflicts with WAS-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.2</version>
        <executions>
          <execution>
            <id>was-specific</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <outputFile>${project.build.directory}/lib/was/nojavax-sisu-inject-bean.jar</outputFile>
              <artifactSet>
                <includes>
                  <include>org.sonatype.sisu:sisu-inject-bean</include>
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>org.sonatype.sisu:sisu-inject-bean</artifact>
                  <excludes>
                    <exclude>javax/**</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- CDI 1.0 specific configuration -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>prepare-cdi1.0-libs</id>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.jboss.errai</groupId>
                  <artifactId>errai-weld-integration</artifactId>
                  <version>${version.org.jboss.errai.cdi10-compatible}</version>
                  <type>jar</type>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/cdi1.0-libs</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- end of WAS 8.5 specific handling -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <finalName>kie-wb-${project.version}</finalName>
          <descriptors>
            <descriptor>${project.basedir}/src/main/community/assembly-kie-wb-jboss-wildfly-8.xml</descriptor>
            <descriptor>${project.basedir}/src/main/community/assembly-kie-wb-jboss-eap-6_4.xml</descriptor>
            <descriptor>${project.basedir}/src/main/community/assembly-kie-wb-tomcat-7.xml</descriptor>
            <descriptor>${project.basedir}/src/main/community/assembly-kie-wb-websphere-as-8.xml</descriptor>
            <descriptor>${project.basedir}/src/main/community/assembly-kie-wb-weblogic-12.xml</descriptor>
          </descriptors>
          <archive>
            <addMavenDescriptor>false</addMavenDescriptor>
            <!-- special manifest entries to allow usage of CXF on WebSphere -->
            <manifestEntries>
              <Ignore-Scanning-Archives>cxf-api-${version.org.apache.cxf}.jar,cxf-rt-bindings-soap-${version.org.apache.cxf}.jar,cxf-rt-bindings-xml-${version.org.apache.cxf}.jar,cxf-rt-core-${version.org.apache.cxf}.jar,cxf-rt-databinding-jaxb-${version.org.apache.cxf}.jar,cxf-rt-frontend-jaxws-${version.org.apache.cxf}.jar,cxf-rt-frontend-simple-${version.org.apache.cxf}.jar,cxf-rt-transports-http-${version.org.apache.cxf}.jar,cxf-rt-ws-addr-${version.org.apache.cxf}.jar,cxf-rt-ws-policy-${version.org.apache.cxf}.jar</Ignore-Scanning-Archives>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>notProductizedProfile</id>
      <activation>
        <property>
          <name>!productized</name>
        </property>
      </activation>

      <properties>
        <webapp.war>org.kie:kie-wb-webapp:war</webapp.war>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-wb-webapp</artifactId>
          <type>war</type>
        </dependency>
      </dependencies>

    </profile>

    <profile>
      <id>productizedProfile</id>

      <activation>
        <property>
          <name>productized</name>
        </property>
      </activation>

      <properties>
        <webapp.war>org.kie:kie-wb-webapp:war:redhat</webapp.war>
      </properties>

      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.kie</groupId>
            <artifactId>kie-wb-webapp</artifactId>
            <version>${version.org.kie}</version>
            <type>war</type>
            <classifier>redhat</classifier>
          </dependency>
        </dependencies>
      </dependencyManagement>

      <dependencies>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-wb-webapp</artifactId>
          <type>war</type>
          <classifier>redhat</classifier>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <finalName>kie-wb-${project.version}</finalName>
              <descriptors>
                <descriptor>${project.basedir}/src/main/productized/assembly-kie-wb-jboss-eap-6_4-redhat.xml</descriptor>
                <descriptor>${project.basedir}/src/main/productized/assembly-kie-wb-tomcat-7-redhat.xml</descriptor>
                <descriptor>${project.basedir}/src/main/productized/assembly-kie-wb-websphere-as-8-redhat.xml</descriptor>
                <descriptor>${project.basedir}/src/main/productized/assembly-kie-wb-weblogic-12-redhat.xml</descriptor>
              </descriptors>
              <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
                <!-- special manifest entries to allow usage of CXF on WebSphere -->
                <manifestEntries>
                  <Ignore-Scanning-Archives>cxf-api-${version.org.apache.cxf}.jar,cxf-rt-bindings-soap-${version.org.apache.cxf}.jar,cxf-rt-bindings-xml-${version.org.apache.cxf}.jar,cxf-rt-core-${version.org.apache.cxf}.jar,cxf-rt-databinding-jaxb-${version.org.apache.cxf}.jar,cxf-rt-frontend-jaxws-${version.org.apache.cxf}.jar,cxf-rt-frontend-simple-${version.org.apache.cxf}.jar,cxf-rt-transports-http-${version.org.apache.cxf}.jar,cxf-rt-ws-addr-${version.org.apache.cxf}.jar,cxf-rt-ws-policy-${version.org.apache.cxf}.jar</Ignore-Scanning-Archives>
                </manifestEntries>
              </archive>
            </configuration>
          </plugin>
        </plugins>
      </build>

    </profile>
  </profiles>

</project>
