<!-- ****************************************************** -->
<!-- ** Experimental Maven build - use at your own risk! ** -->
<!-- ****************************************************** -->

<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>alfresco-remote-api</artifactId>
    <name>Alfresco Remote API</name>
    <parent>
        <artifactId>alfresco-parent</artifactId>
        <groupId>org.alfresco</groupId>
        <version>4.2.c</version>
        <relativePath>../../pom-experimental.xml</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>xml-apis</artifactId>
                    <groupId>xml-apis</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-wdr-deployment</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.security</groupId>
            <artifactId>wss4j</artifactId>
            <version>1.5.4-patched</version>
        </dependency>
        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>20110211</version>
        </dependency>
        <dependency>
            <groupId>javax.portlet</groupId>
            <artifactId>portlet-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.extensions.surf</groupId>
            <artifactId>spring-webscripts</artifactId>
            <version>${dependency.surf.version}</version>
            <exclusions>
            	<exclusion>
            		<artifactId>xml-apis</artifactId>
            		<groupId>xml-apis</groupId>
            	</exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.facebook.api</groupId>
            <artifactId>facebook-java-api</artifactId>
            <version>070716</version>
        </dependency>
        <dependency>
            <groupId>org.alfresco.cmis.client</groupId>
            <artifactId>alfresco-opencmis-extension</artifactId>
            <version>0.3</version>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>saaj-impl</artifactId>
                    <groupId>com.sun.xml.messaging.saaj</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>stax-api</artifactId>
                    <groupId>javax.xml.stream</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
            <version>1.4.5</version>
        </dependency>
        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxrpc-api</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.neethi</groupId>
            <artifactId>neethi</artifactId>
            <version>2.0.4</version>
            <exclusions>
            	<exclusion>
            		<artifactId>xml-apis</artifactId>
            		<groupId>xml-apis</groupId>
            	</exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>rome</groupId>
            <artifactId>rome</artifactId>
            <version>0.9</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.extensions.surf</groupId>
            <artifactId>spring-cmis-framework</artifactId>
            <version>${dependency.surf.version}</version>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit-dep</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.8.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${dependency.spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.chemistry</groupId>
            <artifactId>chemistry-tck-atompub</artifactId>
            <version>0.1-incubating-unreleased</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-deployment</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.extensions.surf</groupId>
            <artifactId>spring-webscripts</artifactId>
            <version>${dependency.surf.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.14</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.3.167</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Wipe the database before starting tests -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sql-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>wipe-database</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <sqlCommand>drop database if exists alfresco</sqlCommand>
                        </configuration>
                    </execution>
                    <execution>
                        <id>create-database</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <sqlCommand>create database alfresco</sqlCommand>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Fetch ImageMagick, needed for ThumbnailServiceTest -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-imagemagick</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.imagemagick</groupId>
                                    <artifactId>imagemagick-distrib</artifactId>
                                    <version>6.3.6</version>
                                    <classifier>${imagemagick.classifier}</classifier>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Exclude tests which should not run -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*Test.*</include>
                    </includes>
                    <excludes>
                        <exclude>**/*SystemTest.*</exclude>
                        <exclude>**/org/alfresco/repo/web/scripts/**/*Test.*</exclude>
                        <exclude>**/WebScriptTestSuite.*</exclude> <!-- TODO investigate why it's failing -->
                    </excludes>
                    <environmentVariables>
                        <MAGICK_CONFIGURE_PATH>${imagemagick.home}/lib/ImageMagick-6.5.1/config:${imagemagick.home}/share/ImageMagick-6.5.1/config</MAGICK_CONFIGURE_PATH>
                        <MAGICK_CODER_MODULE_PATH>${imagemagick.home}/lib/ImageMagick-6.5.1/modules-Q16/coders</MAGICK_CODER_MODULE_PATH>
                    </environmentVariables>
                    <systemPropertyVariables>
                        <img.root>${imagemagick.home}</img.root>
                        <img.exe>${imagemagick.exe}</img.exe>
                        <img.dyn>${imagemagick.home}/lib</img.dyn>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <!--  Create a jar of test classes, to be reused later in remote-api -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                 <executions>
                    <execution>
                        <id>create-test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- TODO Use wsdl2java to regenerate sources 
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>axistools-maven-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <sourceDirectory>${basedir}/source/wsdl</sourceDirectory>
                    <packageSpace>org.alfresco.repo.webservice</packageSpace>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
-->
        </plugins>
    </build>

  <profiles>
    <!-- Complement to the legacy-layout profile to treat the source/generated folder -->
    <!-- TODO: regenerate these properly with wsdl2java! -->
    <profile>
        <id>legacy-layout</id>
        <activation>
            <file>
                <exists>source</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-generated-sources</id>
                            <phase>validate</phase>
                            <goals><goal>copy-resources</goal></goals>
                            <configuration>
                                <outputDirectory>${maven.build.layout.src.main.folder}</outputDirectory>
                                <resources>          
                                    <resource>
                                        <directory>source/generated</directory>
                                        <filtering>${maven.build.filtering.enabled}</filtering>
                                        <includes>
                                            <include>**/*.java</include>
                                        </includes>
                                    </resource>
                                </resources> 
                            </configuration>
                        </execution>
                    </executions>    
                </plugin>                            
            </plugins>
        </build>
    </profile>

    <profile>
        <id>imagemagick-windows</id>
        <activation>
            <os>
              <family>windows</family>
            </os>
        </activation>
        <properties>
            <imagemagick.classifier>windows</imagemagick.classifier>
            <imagemagick.exe>${imagemagick.home}/convert.exe</imagemagick.exe>
        </properties>
    </profile>

    <profile>
        <id>imagemagick-linux</id>
        <activation>
            <os>
              <family>linux</family>
            </os>
        </activation>
        <properties>
            <imagemagick.classifier>linux</imagemagick.classifier>
            <imagemagick.exe>${imagemagick.home}/bin/.convert.bin</imagemagick.exe>
        </properties>
    </profile>

   <profile>
        <id>imagemagick-mac</id>
        <activation>
            <os>
              <family>mac</family>
            </os>
        </activation>
        <properties>
            <imagemagick.classifier>linux</imagemagick.classifier>
            <imagemagick.exe>${imagemagick.home}/bin/.convert.bin</imagemagick.exe>
        </properties>
    </profile>

  </profiles>

  <properties>
      <imagemagick.home>${project.build.directory}/dependency/ImageMagick</imagemagick.home>
  </properties>

</project>
