<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>
        <artifactId>seam-rest-parent</artifactId>
        <groupId>org.jboss.seam.rest</groupId>
        <version>3.1.0.Beta2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>seam-rest</artifactId>
    <version>3.1.0.Beta2</version>

    <packaging>jar</packaging>
    <name>Seam REST Module Implementation</name>
    <url>http://seamframework.org/Seam3/RESTModule</url>

    <properties>
        <jbossas7.version>7.0.1.Final</jbossas7.version>
        <jbossas6.version>6.1.0.Final</jbossas6.version>
        <jboss.osgi.version>1.0.27</jboss.osgi.version>
        <arquillian.version>1.0.0.CR3</arquillian.version>
    </properties>

    <dependencies>
        <dependency>
            <artifactId>seam-rest-api</artifactId>
            <groupId>org.jboss.seam.rest</groupId>
        </dependency>

        <dependency>
            <groupId>org.jboss.seam.solder</groupId>
            <artifactId>seam-solder</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.el</groupId>
            <artifactId>jboss-el-api_2.2_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Optional dependencies -->
        <dependency>
            <groupId>org.jboss.seam.catch</groupId>
            <artifactId>seam-catch</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity-tools</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
            <version>${arquillian.version}</version>
        </dependency>
        
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
        </dependency>
        <!-- We need ManifestBuilder utility class from this package for AS7 testing -->
        <dependency>
            <groupId>org.jboss.osgi.spi</groupId>
            <artifactId>jbosgi-spi</artifactId>
            <version>${jboss.osgi.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- slf4j required for HTTPClient -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.1_spec</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <additionalClasspathElements>
                                <additionalClasspathElement>${basedir}/target/lib</additionalClasspathElement>
                            </additionalClasspathElements>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>code-coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>emma-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>deploy-emma-jar</id>
                                <phase>process-test-sources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>emma</groupId>
                                            <artifactId>emma</artifactId>
                                            <version>${emma.version}</version>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${env.JBOSS_HOME}/server/default/lib</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>retrieve-coverage-file</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <move file="${env.JBOSS_HOME}/bin/coverage.ec" todir="${basedir}" failonerror="false" />
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>remove-coverage-files</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <delete file="${basedir}/transaction.log" failonerror="false" />
                                        <delete file="${basedir}/coverage.ec" failonerror="false" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.maven.plugin</groupId>
                        <artifactId>emma4it-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>

            <activation>
                <property>
                    <name>managed</name>
                </property>
            </activation>
            <id>jbossas-managed-6</id>
            <properties>
                <bindAddress>localhost</bindAddress>
                <httpPort>8080</httpPort>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.jbossas</groupId>
                    <artifactId>jboss-as-client</artifactId>
                    <type>pom</type>
                    <version>${jbossas6.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-jbossas-managed-6</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.jbossas</groupId>
                    <artifactId>jboss-server-manager</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>jbossas-remote-6</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.jbossas</groupId>
                    <artifactId>jboss-as-profileservice-client</artifactId>
                    <version>${jbossas6.version}</version>
                    <type>pom</type>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-jbossas-remote-6</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>jbossas-remote-7</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-arquillian-container-remote</artifactId>
                    <version>${jbossas7.version}</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>jbossas-managed-7</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-arquillian-container-managed</artifactId>
                    <version>${jbossas7.version}</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>glassfish-remote-3.1</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.arquillian.container</groupId>
                    <artifactId>arquillian-glassfish-remote-3.1</artifactId>
                    <scope>test</scope>
                </dependency>
                <!-- Workaround for ARQ-543 -->
                <dependency>
                    <groupId>org.jboss.arquillian.testenricher</groupId>
                    <artifactId>arquillian-testenricher-initialcontext</artifactId>
                    <version>1.0.0.CR4</version>
                </dependency>
                <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-bundle</artifactId>
                    <version>1.5</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.jersey.contribs</groupId>
                    <artifactId>jersey-multipart</artifactId>
                    <version>1.5</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <!-- Exclude RESTEasy-dependent tests -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-test</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <additionalClasspathElements>
                                        <additionalClasspathElement>${basedir}/target/lib</additionalClasspathElement>
                                    </additionalClasspathElements>
                                    <excludes>
                                        <!-- Do not run rest client tests -->
                                        <exclude>**/client/**/*.java</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

