<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>
  <groupId>net.disy.legato</groupId>
  <artifactId>legato-demo</artifactId>
  <packaging>war</packaging>
  <name>Legato Demo</name>
  <parent>
    <groupId>net.disy.legato</groupId>
    <artifactId>legato-parent</artifactId>
    <version>2.0.0</version>
    <relativePath>../legato-parent/pom.xml</relativePath>
  </parent>
  <dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>net.disy.legato</groupId>
      <artifactId>legato-tools</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>net.disy.legato</groupId>
      <artifactId>legato-testing</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>src/main/webapp</directory>
              <includes>
                <include>*</include>
              </includes>
              <excludes>
                <exclude>.svn</exclude>
                <exclude>WEB-INF/**</exclude>
              </excludes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <id>unpack-javascript</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>net.disy.legato</groupId>
                  <artifactId>legato-demo-dev</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <outputDirectory>src/main/webapp</outputDirectory>
                  <excludes>META-INF/**,WEB-INF/**</excludes>
                </artifactItem>
                <artifactItem>
                  <groupId>net.disy.legato</groupId>
                  <artifactId>legato-openlayers</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                  <outputDirectory>target/unpacked-dependencies</outputDirectory>
                  <excludes>META-INF/**</excludes>
                </artifactItem>
                <artifactItem>
                  <groupId>net.disy.legato</groupId>
                  <artifactId>legato-scripts</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                  <outputDirectory>target/unpacked-dependencies</outputDirectory>
                  <excludes>META-INF/**</excludes>
                </artifactItem>
                <artifactItem>
                  <groupId>net.disy.legato</groupId>
                  <artifactId>legato-jquery</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                  <outputDirectory>target/unpacked-dependencies</outputDirectory>
                  <excludes>META-INF/**</excludes>
                </artifactItem>
                <artifactItem>
                  <groupId>net.disy.prototype</groupId>
                  <artifactId>prototype</artifactId>
                  <version>1.6.0.3</version>
                  <type>jar</type>
                  <outputDirectory>target/unpacked-dependencies</outputDirectory>
                  <excludes>META-INF/**</excludes>
                </artifactItem>
                <artifactItem>
                  <groupId>net.disy.jquery</groupId>
                  <artifactId>jquery</artifactId>
                  <version>1.7.2</version>
                  <type>jar</type>
                  <outputDirectory>target/unpacked-dependencies</outputDirectory>
                  <includes>com/jquery/**/*</includes>
                </artifactItem>
                <artifactItem>
                  <groupId>net.disy.jquery</groupId>
                  <artifactId>jquery-ui</artifactId>
                  <version>1.8.20</version>
                  <type>jar</type>
                  <outputDirectory>target/unpacked-dependencies</outputDirectory>
                  <includes>com/jquery/ui/**/*</includes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-javascript</id>
            <phase>process-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <!-- Extract prototype files -->
                <mkdir dir="src/main/webapp/js/prototype/lib" />
                <copy todir="src/main/webapp/js/prototype/lib">
                  <fileset dir="target/unpacked-dependencies/org/prototypejs">
                    <include name="prototype.js" />
                  </fileset>
                </copy>

               <!-- Copy JQuery files -->
                <mkdir dir="src/main/webapp/js/jquery" />
                <copy todir="src/main/webapp/js/jquery">
                  <fileset dir="target/unpacked-dependencies/com/jquery">
                    <include name="*.*" />
                  </fileset>
                </copy>
                <!-- Copy JQuery UI files -->
                <mkdir dir="src/main/webapp/js/jquery-ui" />
                <copy todir="src/main/webapp/js/jquery-ui">
                  <fileset dir="target/unpacked-dependencies/com/jquery/ui/">
                    <include name="**/*.*" />
                  </fileset>
                </copy>
                <!-- Copy JQuery Theme files -->
                <mkdir dir="src/main/webapp/js/jquery-ui/css/" />
                <copy todir="src/main/webapp/js/jquery-ui/css">
                  <fileset dir="target/unpacked-dependencies/com/jquery/ui/css/">
                    <include name="**/*.*" />
                  </fileset>
                </copy>

                <!-- Extract OpenLayers files -->
                <mkdir dir="src/main/webapp/js/OpenLayers/lib" />
                <mkdir dir="src/main/webapp/js/OpenLayers/img" />
                <mkdir dir="src/main/webapp/js/OpenLayers/theme" />
                <copy todir="src/main/webapp/js/OpenLayers">
                  <fileset dir="target/unpacked-dependencies/org/openlayers/aggregated">
                    <include name="OpenLayers.js" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/OpenLayers/lib">
                  <fileset dir="target/unpacked-dependencies/org/openlayers">
                    <include name="Firebug/**/*.*" />
                    <include name="Gears/**/*.*" />
                    <include name="OpenLayers/**/*.*" />
                    <include name="Rico/**/*.*" />
                    <include name="OpenLayers.js" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/OpenLayers/img">
                  <fileset dir="target/unpacked-dependencies/org/openlayers/img">
                    <include name="**/*.*" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/OpenLayers/theme">
                  <fileset dir="target/unpacked-dependencies/org/openlayers/theme">
                    <include name="**/*.*" />
                  </fileset>
                </copy>
                <!-- Extract Proj4js files -->
                <mkdir dir="src/main/webapp/js/Proj4js/lib" />
                <copy todir="src/main/webapp/js/Proj4js/lib">
                  <fileset dir="target/unpacked-dependencies/org/proj4js">
                    <include name="proj4js*.js" />
                  </fileset>
                </copy>
                <!-- Extract Legato files -->
                <mkdir dir="src/main/webapp/js/Legato/lib" />
                <mkdir dir="src/main/webapp/js/Legato/theme" />
                <copy todir="src/main/webapp/js/Legato">
                  <fileset dir="target/unpacked-dependencies/net/disy/legato/aggregated">
                    <include name="Legato.js" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/Legato/lib">
                  <fileset dir="target/unpacked-dependencies/net/disy/legato">
                    <include name="Legato/**/*.*" />
                    <include name="Legato.js" />
                  </fileset>
                </copy>
                <!-- Extract Legato jquery files -->
                <mkdir dir="src/main/webapp/js/LegatoJQuery/lib" />
                <mkdir dir="src/main/webapp/js/JQueryPlugins/theme" />
                <copy todir="src/main/webapp/js/LegatoJQuery">
                  <fileset dir="target/unpacked-dependencies/net/disy/legato/aggregated">
                    <include name="LegatoJQuery.js" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/LegatoJQuery/lib">
                  <fileset dir="target/unpacked-dependencies/net/disy/legato">
                    <include name="LegatoJQuery/**/*.*" />
                    <include name="LegatoJQuery.js" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/JQueryPlugins">
                  <fileset dir="target/unpacked-dependencies/net/disy/jquery/aggregated">
                    <include name="JQueryPlugins.js" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/JQueryPlugins/lib">
                  <fileset dir="target/unpacked-dependencies/net/disy/jquery">
                    <include name="JQueryPlugins/**/*.*" />
                    <include name="JQueryPlugins.js" />
                  </fileset>
                </copy>
                <!--
                  copy todir="src/main/webapp/js/Legato/img"> <fileset dir="target/unpacked-dependencies/net/disy/legato/img">
                  <include name="**/*.*" /> </fileset> </copy -->
                <copy todir="src/main/webapp/js/Legato/theme">
                  <fileset dir="target/unpacked-dependencies/net/disy/legato/theme">
                    <include name="**/*.*" />
                  </fileset>
                </copy>
                <copy todir="src/main/webapp/js/JQueryPlugins/theme">
                  <fileset dir="target/unpacked-dependencies/net/disy/jquery/theme">
                    <include name="**/*.*" />
                  </fileset>
                </copy>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.mycila.maven-license-plugin</groupId>
        <artifactId>maven-license-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>src/test/resources/**</exclude>
            <exclude>src/main/webapp/**</exclude>
            <exclude>target-eclipse/**</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>