<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <name>JBoss 7 - Management Console :: Standalone</name>
    <groupId>org.jboss.as</groupId>
    <artifactId>jboss-as-console</artifactId>
    <packaging>war</packaging>

    <!-- Parent -->
    <parent>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-console-parent</artifactId>
        <version>1.0.0.Beta3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <!--  Dependencies -->
    <dependencies>

        <!-- 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.code.gwt-log</groupId>
            <artifactId>gwt-log</artifactId>
        </dependency>

        <dependency>
            <groupId>com.gwtplatform</groupId>
            <artifactId>gwtp-all</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>net.sourceforge.htmlunit</groupId>
                    <artifactId>crawl_htmlunit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.gwt.inject</groupId>
            <artifactId>gin</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mycila.com.google.inject.extensions</groupId>
            <artifactId>guice-assisted-inject</artifactId>
        </dependency>

    </dependencies>

    <!-- Plugins -->
    <build>
        <finalName>standalone-console</finalName>
        <outputDirectory>war/WEB-INF/classes</outputDirectory>

        <resources>
            <resource>
                <directory>src/main/java</directory>
            </resource>
        </resources>

        <plugins>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.2.0</version>
                <configuration>
                    <inplace>true</inplace>
                    <logLevel>TRACE</logLevel>
                    <runTarget>App.html</runTarget>
                    <warSourceDirectory>war</warSourceDirectory>
                    <extraJvmArgs>-Xmx512m -DDEBUG</extraJvmArgs>
                    <servicePattern>**/*Service.java</servicePattern>
                    <soyc>false</soyc>
                    <style>OBF</style>
                    <hostedWebapp>war</hostedWebapp>
                    <localWorkers>2</localWorkers>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>clean</goal>
                            <goal>resources</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <descriptors>
                        <descriptor>scripts/assembly.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>


            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1-beta-1</version>
                <configuration>
                    <warSourceDirectory>war</warSourceDirectory>
                    <webappDirectory>war</webappDirectory>
                </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 dir="war/WEB-INF/deploy"/>
                                <!--delete file="war/WEB-INF/jboss-web.xml"/>
                                <delete file="war/WEB-INF/web.xml"/-->
                                <delete dir="war/app"/>
                                <delete dir="war/dmr_gwt"/>
                                <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>
                                <!-- bump number first-->
                                <buildnumber/>

                                <ant antfile="../scripts/antrun-version.xml" inheritAll="false" inheritRefs="false">
                                    <property file="build.number"/>
                                    <property name="version" value="${project.version}"/>
                                    <property name="build.user" value="${user.name}"/>
                                    <property name="src.dir" value="${project.build.directory}/generated-sources" />
                                </ant>
                            </tasks>
                            <sourceRoot>
                                ${project.build.directory}/generated-sources
                            </sourceRoot>
                        </configuration>
                    </execution>


                </executions>
            </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>

    </profiles>

    <pluginRepositories>
        <pluginRepository>
            <id>gwtplatform.plugin</id>
            <name>Gwtplatform custom plugin epository</name>
            <url>http://maven.gwt-platform.googlecode.com/hg/</url>
            <layout>default</layout>
        </pluginRepository>
    </pluginRepositories>
</project>
