<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-share-services</artifactId>
    <name>Alfresco Share Services AMP</name>
    <description>Module to be applied to alfresco.war, containing APIs for Alfresco Share</description>
    <packaging>amp</packaging>
    <parent>
        <artifactId>alfresco-share-parent</artifactId>
        <groupId>org.alfresco</groupId>
        <version>5.1.a-EA</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-remote-api</artifactId>
            <version>${alfresco.platform.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${alfresco.platform.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-remote-api</artifactId>
            <version>${alfresco.platform.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.extensions.surf</groupId>
            <artifactId>spring-webscripts</artifactId>
            <version>${dependency.webscripts.version}</version>
            <classifier>tests</classifier>
            <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.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <!-- AMP specific resources -->
            <resource>
                <directory>src/main/amp</directory>
                <targetPath>../${project.build.finalName}</targetPath>
                <filtering>true</filtering>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <!-- AMP specific resources needs to be on the classpath for test runs -->
            <testResource>
                <directory>src/main/amp/config</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.alfresco.maven.plugin</groupId>
                <artifactId>alfresco-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Specification-Version>${version.major}.${version.minor}.${version.revision}</Specification-Version>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Build-Date>${maven.build.timestamp}</Build-Date>
                            <Build-Name>${bamboo_planName}</Build-Name>
                            <Build-Key>${bamboo_fullBuildKey}</Build-Key>
                            <Build-Number>${bamboo_buildNumber}</Build-Number>
                            <Build-Revision>${bamboo_repository_revision_number}</Build-Revision>
                        </manifestEntries>
                    </archive>
                </configuration>                
            </plugin>

            <plugin>
               <artifactId>maven-surefire-plugin</artifactId>
               <executions>
                  <execution>
                     <id>default-test</id>
                     <!-- No unit tests in this project - all tests are integration tests -->
                     <configuration>
                          <includes>
                              <include />
                          </includes>
                     </configuration>
                  </execution>
               </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>integration-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                               <id>integration-tests</id>
                               <goals>
                                  <goal>test</goal>
                               </goals>
                               <configuration>
                                  <includes combine.self="override">
                                     <include>**/*Test.java</include>
                                  </includes>
                               </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
   </profiles>
</project>
