<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <name>JBoss BPM - Console::GUI::Webapp</name>
    <groupId>org.jboss.bpm</groupId>
    <artifactId>gwt-console</artifactId>
    <packaging>war</packaging>

    <!-- Parent -->
    <parent>
        <groupId>org.jboss.bpm</groupId>
        <artifactId>gwt-console-gui</artifactId>
        <version>2.0.3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <properties>
        <gwt-maven.version>2.0-RC1</gwt-maven.version>        
    </properties>

    <!--  Dependencies -->
    <dependencies>

        <dependency>
            <groupId>org.jboss.errai</groupId>
            <artifactId>errai-bus</artifactId>
            <version>${errai.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.errai</groupId>
            <artifactId>errai-widgets</artifactId>
            <version>${errai.version}</version>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.errai</groupId>
            <artifactId>errai-workspaces</artifactId>
            <version>${errai.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.bpm</groupId>
            <artifactId>gwt-console-rpc</artifactId>
            <classifier>sources</classifier>
            <version>${version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.bpm</groupId>
            <artifactId>gwt-console-rpc</artifactId>
            <version>${version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.bpm</groupId>
            <artifactId>report-shared</artifactId>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.bpm</groupId>
            <artifactId>report-shared</artifactId>
        </dependency>

        <!-- GWT -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <scope>provided</scope>
            <version>${gwt.version}</version>
        </dependency>

        <dependency>
            <groupId>org.mvel</groupId>
            <artifactId>mvel2</artifactId>
            <version>${mvel.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.guice</groupId>
            <artifactId>guice</artifactId>
            <version>${guice.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.guice</groupId>
            <artifactId>guice</artifactId>
            <version>${guice.version}</version>
            <classifier>aopalliance</classifier>
        </dependency>

        <!-- GWT extensions -->

        <!-- Mosaic -->
        <!--dependency>
            <groupId>com.googlecode.gwtmosaic</groupId>
            <artifactId>gwt-mosaic</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.gwtmosaic</groupId>
            <artifactId>gwt-beans-binding</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.gwtmosaic</groupId>
            <artifactId>gwt-dnd</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.gwtmosaic</groupId>
            <artifactId>gwtx</artifactId>
            <scope>provided</scope>
        </dependency-->

        <dependency>
            <groupId>com.googlecode.mvc4g</groupId>
            <artifactId>mvc4g</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- 3rd party -->

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>${javax.jaxb.version}</version>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.stream</groupId>
            <artifactId>stax-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.9</version>
        </dependency>

    </dependencies>

    <!-- Plugins -->
    <build>
        <finalName>gwt-console</finalName>
        <outputDirectory>war/WEB-INF/classes</outputDirectory>

        <plugins>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.maven}</version>
                <configuration>
                    <inplace>true</inplace>
                    <logLevel>DEBUG</logLevel>
                    <runTarget>app.html</runTarget>
                    <warSourceDirectory>war</warSourceDirectory>
                    <extraJvmArgs>-Xmx512m</extraJvmArgs>
                    <localWorkers>2</localWorkers>
                    <soyc>false</soyc>
                    <style>OBF</style>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warSourceDirectory>war</warSourceDirectory>
                    <webappDirectory>war</webappDirectory>
                    <warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
                    <webResources>
                        <resource>
                            <!-- this is relative to the pom.xml directory -->
                            <directory>src/main/templates</directory>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>clean.war</id>
                        <phase>clean</phase>
                        <configuration>
                            <tasks>
                                <!--
                                    The gwt-maven-plugin use the war source folder
                                    as it's build directory. We need to cleanup after we'd run
                                    the plugin and remove all GWT related artifacts that are required
                                    to run the hosted mode.
                                -->
                                <delete dir="war/WEB-INF/classes"/>
                                <delete dir="war/WEB-INF/lib"/>
                                <delete file="war/WEB-INF/jboss-web.xml"/>
                                <delete dir="war/app"/>
                                <delete dir="target"/>

                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>

                    <execution>
                        <id>generate-version-class</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <ant antfile="scripts/antrun-version.xml" inheritAll="false" inheritRefs="false">
                                    <property name="version" value="${version}" />
                                    <property name="src.dir" value="${project.build.directory}/generated-sources" />
                                </ant>
                            </tasks>
                            <sourceRoot>
                                ${project.build.directory}/generated-sources
                            </sourceRoot>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>

        <profile>
            <id>quick-hosted-mode</id>
            <activation>
                <property>
                    <name>hosted</name>
                </property>
            </activation>
            <properties>
                <google.webtoolkit.compileSkip>true</google.webtoolkit.compileSkip>
                <o>true</o> <!-- offline -->
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>gwt-maven-plugin</artifactId>
                        <version>${gwt.maven}</version>
                        <configuration>
                            <draftCompile>true</draftCompile>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!--
         =======================================================
          jBPM Profile (default)
         =======================================================
        -->
        <profile>
            <id>jbpm-console.profile</id>
            <activation>
                <property>
                    <name>!console.profile</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.bpm</groupId>
                    <artifactId>gwt-console-profile-jbpm</artifactId>
                    <version>${version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <properties>
                <console.app.webcontext>jbpm-console</console.app.webcontext>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-profile-jbpm</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.bpm</groupId>
                                            <artifactId>gwt-console-profile-jbpm</artifactId>
                                            <version>${version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>war/app</outputDirectory>
                                            <includes>**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <!-- the war:war goal removes the unpacked config
                            hence the redundant call here -->
                            <execution>
                                <id>unpack-profile-jbpm2</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.bpm</groupId>
                                            <artifactId>gwt-console-profile-jbpm</artifactId>
                                            <version>${version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>war/app</outputDirectory>
                                            <includes>**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>

                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <classifier>jbpm</classifier>
                        </configuration>
                    </plugin>
                </plugins>

            </build>
        </profile>

        <!--
           =======================================================
            Drools Profile
           =======================================================
        -->
        <profile>
            <id>drools-console.profile</id>
            <activation>
                <property>
                    <name>console.profile</name>
                    <value>drools</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.bpm</groupId>
                    <artifactId>gwt-console-profile-drools</artifactId>
                    <version>${version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <properties>
                <console.app.webcontext>gwt-console</console.app.webcontext>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>

                            <execution>
                                <id>unpack-profile-drools</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.bpm</groupId>
                                            <artifactId>gwt-console-profile-drools</artifactId>
                                            <version>${version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>war/app</outputDirectory>
                                            <includes>**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-profile-drools2</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.bpm</groupId>
                                            <artifactId>gwt-console-profile-drools</artifactId>
                                            <version>${version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>war/app</outputDirectory>
                                            <includes>**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <classifier>drools</classifier>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!--
         =======================================================
          Riftsaw Profile
         =======================================================
        -->
        <profile>
            <id>riftsaw-console.profile</id>
            <activation>
                <property>
                    <name>console.profile</name>
                    <value>riftsaw</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.bpm</groupId>
                    <artifactId>gwt-console-profile-riftsaw</artifactId>
                    <version>${version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <properties>
                <console.app.webcontext>bpel-console</console.app.webcontext>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>

                            <execution>
                                <id>unpack-profile-riftsaw</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.bpm</groupId>
                                            <artifactId>gwt-console-profile-riftsaw</artifactId>
                                            <version>${version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>war/app</outputDirectory>
                                            <includes>**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-profile-riftsaw2</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.bpm</groupId>
                                            <artifactId>gwt-console-profile-riftsaw</artifactId>
                                            <version>${version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>war/app</outputDirectory>
                                            <includes>**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <classifier>riftsaw</classifier>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>

    </profiles>

</project>
