<?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>com.terradue</groupId>
    <artifactId>java-parent</artifactId>
    <version>2</version>
  </parent>

  <groupId>org.gcube.data.analysis</groupId>
  <artifactId>wps-hadoop-sm</artifactId>
  <version>1.0.0-SNAPSHOT</version> 
  <packaging>jar</packaging>
  
  
	<distributionManagement>
		<snapshotRepository>
		<id>gcube-snapshots</id>
		<name>gCube Snapshots</name>
		<url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/gcube-snapshots</url>
		</snapshotRepository>
	</distributionManagement>


  <properties>
    <hadoop.version>0.20.2-cdh3u3</hadoop.version>
    <tomcat.version>7.0.26</tomcat.version>
  </properties>

  <dependencies>
    <dependency> 
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-streaming</artifactId> 
      <version>${hadoop.version}</version> 
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-core</artifactId>
      <version>${hadoop.version}</version> 
    </dependency>

    <dependency>
      <groupId>org.n52.wps</groupId>
      <artifactId>52n-wps-server</artifactId>
      <version>3.0</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>edu.ucar</groupId>
      <artifactId>netcdf</artifactId>
      <version>4.2.20</version>
    </dependency>
    <dependency>
      <groupId>edu.ucar</groupId>
      <artifactId>opendap</artifactId>
      <version>2.2.2</version>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.16</version>
    </dependency>
    <dependency>
      <groupId>com.terradue</groupId>
      <artifactId>jcatalogue-client</artifactId>
      <version>0.8</version>
      <classifier>imarine</classifier>
    </dependency>
    <!-- BEGIN brute-force trick! -->
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.8.3</version>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils-core</artifactId>
      <version>1.8.3</version>
      <scope>provided</scope>
    </dependency>
    <!-- END brute-force trick! -->

    <dependency>
      <groupId>org.apache.abdera</groupId>
      <artifactId>abdera-parser</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.ws.commons.axiom</groupId>
      <artifactId>axiom-api</artifactId>
      <version>1.2.10</version>
    </dependency>
    <dependency>
  		<groupId>org.gcube.contentmanagement</groupId>
  		<artifactId>storage-manager-wrapper</artifactId>
  		<version>1.0.0-SNAPSHOT</version>
  	</dependency>
  	<dependency>
  		<groupId>org.gcube.contentmanagement</groupId>
  		<artifactId>storage-manager-core</artifactId>
  		<version>1.0.0-SNAPSHOT</version>
  	</dependency>
  	<dependency>
  		<groupId>org.gcube.distribution</groupId>
  		<artifactId>ghn-client-runtime</artifactId>
  		<version>1.0.0-SNAPSHOT</version>
  		<classifier>dev</classifier>
  	</dependency>
  </dependencies>
  
  
<repositories>
    <repository>
    	<id>52north</id>
    	<url>http://maven.research-infrastructures.eu/nexus/content/repositories/52north-releases/</url>
    </repository>
    <repository>
    	<id>cloudera</id>
    	<url>https://repository.cloudera.com/artifactory/public/</url>
    </repository>
</repositories>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
<!--              <exclude>**/gmtsar/</exclude> -->
             <exclude>**/wps/</exclude> 
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>true</attach>
              <tarLongFileMode>gnu</tarLongFileMode>
              <descriptors>
                <descriptor>${basedir}/src/main/assembly/bin.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>hadoop-streaming</id>
      <properties>
        <qualifier.id>hadoop-streaming</qualifier.id>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/HadoopStreaming*</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>wps</id>
      <properties>
        <qualifier.id>wps</qualifier.id>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/HadoopStreaming*</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release</id>

      <dependencies>
        <dependency>
          <groupId>org.n52.wps</groupId>
          <artifactId>52n-wps-webapp</artifactId>
          <version>3.0</version>
          <type>war</type>
          <scope>provided</scope>
        </dependency>
        <!--
         | Tomcat dependencies
         -->
        <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-catalina</artifactId>
          <version>${tomcat.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-coyote</artifactId>
          <version>${tomcat.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-jasper</artifactId>
          <version>${tomcat.version}</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-juli</artifactId>
          <version>${tomcat.version}</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <sourcepath>${basedir}/src/main/java/com/terradue/wps_hadoop</sourcepath>
                  <quiet>true</quiet>
                  <archive>
                    <manifest>
                      <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                      <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                    </manifest>
                    <manifestEntries>
                      <Implementation-Build>${implementation.build}</Implementation-Build>
                      <X-Compile-Source-JDK>${javac.src.version}</X-Compile-Source-JDK>
                      <X-Compile-Target-JDK>${javac.target.version}</X-Compile-Target-JDK>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>src-dependencies</id>
                <phase>package</phase>
                <goals>
                  <!-- use copy-dependencies instead if you don't want to explode the sources -->
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <includeTypes>war</includeTypes>
                  <includeScope>provided</includeScope>
                  <outputDirectory>${project.build.directory}/wps-war-exploded</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                  <tarLongFileMode>gnu</tarLongFileMode>
                  <descriptors>
                    <descriptor>${basedir}/src/main/assembly/src.xml</descriptor>
                    <descriptor>${basedir}/src/main/assembly/bootstrap.xml</descriptor>
                    <descriptor>${basedir}/src/main/assembly/tomcat-embedded.xml</descriptor>
                  </descriptors>
                  <archive>
                    <manifest>
                      <mainClass>org.apache.catalina.startup.Bootstrap</mainClass>
                      <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                      <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                    </manifest>
                    <manifestEntries>
                      <Class-Path>tomcat-juli.jar</Class-Path>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.1.2</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
                <configuration>
                  <excludes>
                    <exclude>**/wps/</exclude>
                  </excludes>
                  <archive>
                    <manifest>
                      <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                      <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                    </manifest>
                    <manifestEntries>
                      <Implementation-Build>${implementation.build}</Implementation-Build>
                      <X-Compile-Source-JDK>${javac.src.version}</X-Compile-Source-JDK>
                      <X-Compile-Target-JDK>${javac.target.version}</X-Compile-Target-JDK>
                    </manifestEntries>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
