<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>
  <artifactId>gwtupload-samples</artifactId>
  <packaging>war</packaging>
  <name>GwtUpload Examples</name>
  <description>Examples ready to deploy</description>

  <parent>
    <groupId>com.googlecode.gwtupload</groupId>
    <artifactId>gwtupload-project</artifactId>
    <version>1.0.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwtVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>${groupId}</groupId>
      <artifactId>gwtupload</artifactId>
      <version>${version}</version>
    </dependency>
    <dependency>
      <groupId>${groupId}</groupId>
      <artifactId>jsupload</artifactId>
      <version>${version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.timepedia.exporter</groupId>
      <artifactId>gwtexporter</artifactId>
      <version>${gwtExporterVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>gwtchismes</groupId>
      <artifactId>gwtchismes</artifactId>
      <version>${gwtChismesVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-incubator</artifactId>
      <version>${gwtIncubatorVersion}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-webapp</artifactId>
      <version>${jetty.version}</version>
    </dependency>
  </dependencies>

  <properties>
    <www>${project.build.directory}/www</www>
    <jetty.version>7.3.0.v20110203</jetty.version>
  </properties>

  <build>
   <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <resources>
      <resource><directory>src/main/java</directory></resource>
      <resource><directory>src/main/resources</directory></resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
           <downloadSources>true</downloadSources>
           <downloadJavadocs>false</downloadJavadocs>
           <additionalBuildcommands>
             <buildCommand>
               <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
             </buildCommand>
           </additionalBuildcommands>
           <additionalProjectnatures>
             <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
           </additionalProjectnatures>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
              <resources>
                <resource>
                  <directory>src/main/webapp</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>${gwtMaven}</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- URL that should be automatically opened in the GWT shell (gwt:run). -->
          <runTarget>index.html</runTarget>
          <!-- Location of the develop-mode web application structure (gwt:run). -->
          <hostedWebapp>${war}</hostedWebapp>
          <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
          <compileReport>true</compileReport>
          <!-- Style OBFUSCATED PRETTY -->
          <style>OBF</style>
          <!-- Compress a bit more the js output -->
          <disableCastChecking>true</disableCastChecking>
          <!-- Modules to compile -->
          <modules>
            <module>gwtuploadsample.ChismesUploadSample</module>
            <module>gwtuploadsample.SingleUploadSample</module>
            <module>gwtuploadsample.MultipleUploadSample</module>
            <module>jsupload.JsUpload</module>
          </modules>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset><directory>src/main/webapp/gwtupload</directory></fileset>
            <fileset><directory>src/main/webapp/gwtuploadsample.ChismesUploadSample</directory></fileset>
            <fileset><directory>src/main/webapp/gwtuploadsample.MultipleUploadSample</directory></fileset>
            <fileset><directory>src/main/webapp/gwtuploadsample.Sample</directory></fileset>
            <fileset><directory>src/main/webapp/gwtuploadsample.SingleUploadSample</directory></fileset>
            <fileset><directory>src/main/webapp/jsupload</directory></fileset>
            <fileset><directory>src/main/webapp/jsupload.JsUploadLib</directory></fileset>
            <fileset><directory>src/main/webapp/WEB-INF/classes</directory></fileset>
            <fileset><directory>tomcat</directory></fileset>
            <fileset><directory>www-test</directory></fileset>
            <fileset><directory>.gwt-tmp</directory></fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <phase>deploy</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
           <downloadSources>true</downloadSources>
           <downloadJavadocs>false</downloadJavadocs>
           <additionalBuildcommands>
             <buildCommand>
               <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
             </buildCommand>
           </additionalBuildcommands>
           <additionalProjectnatures>
             <projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
           </additionalProjectnatures>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>jar</id>
            <phase>compile</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <executions>
          <execution>
            <phase>deploy</phase>
            <goals>
              <goal>deploy-file</goal>
            </goals>
            <configuration>
              <packaging>jar</packaging>
              <generatePom>true</generatePom>
              <url>${project.distributionManagement.repository.url}</url>
              <artifactId>${project.artifactId}</artifactId>
              <groupId>${project.groupId}</groupId>
              <version>${project.version}</version>
              <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
              <url>${sonatypeUrl}</url>
              <repositoryId>${sonatypeRepoId}</repositoryId>
            </configuration>
          </execution>
        </executions>
      </plugin> 
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <executions>
          <execution>
            <phase>install</phase>
            <goals>
              <goal>install-file</goal>
            </goals>
            <configuration>
              <packaging>jar</packaging>
              <artifactId>${project.artifactId}</artifactId>
              <groupId>${project.groupId}</groupId>
              <version>${project.version}</version>
              <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
            </configuration>
          </execution>
        </executions>
      </plugin> 
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <executions>
              <execution>
                  <id>copy-resources</id>
                  <phase>generate-sources</phase>
                  <goals>
                      <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                      <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
                      <resources>
                          <resource>
                              <directory>src/main/webapp</directory>
                          </resource>
                      </resources>
                  </configuration>
              </execution>
              <execution>
                  <id>copy-launcher</id>
                  <phase>prepare-package</phase>
                  <goals>
                      <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                      <outputDirectory>${project.build.directory}/${project.build.finalName}</outputDirectory>
                      <resources>
                          <resource>
                              <directory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</directory>
                              <include>gwtuploadsample/Launcher.class</include>
                          </resource>
                      </resources>
                  </configuration>
              </execution>
          </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
          <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
          <warName>${project.artifactId}-${project.version}</warName>
          <archive>
              <manifest>
                  <mainClass>gwtuploadsample.Launcher</mainClass>
              </manifest>
          </archive>
        </configuration>
      </plugin>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
              <execution>
                  <id>jetty-classpath</id>
                  <phase>prepare-package</phase>
                  <goals>
                      <goal>unpack-dependencies</goal>
                  </goals>
                  <configuration>
                      <includeGroupIds>org.eclipse.jetty,javax.servlet</includeGroupIds>
                      <excludeArtifactIds>jsp-api,jstl</excludeArtifactIds>
                      <outputDirectory>
                          ${project.build.directory}/${project.artifactId}-${project.version}
                  </outputDirectory>
                  </configuration>
              </execution>
          </executions>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty.version}</version>
        <configuration>
          <webAppConfig>
            <contextPath>/${project.name}</contextPath>
          </webAppConfig>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
