<?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>org.modeshape</groupId>
        <artifactId>modeshape-parent</artifactId>
        <version>3.7.2.Final</version>
        <relativePath>../modeshape-parent/pom.xml</relativePath>
    </parent>

    <!-- The groupId and version values are inherited from parent -->
    <artifactId>modeshape-jdbc</artifactId>
    <packaging>jar</packaging>
    <name>ModeShape JDBC Driver</name>
    <description>JDBC driver to allow clients to use JCR-SQL2 to query a local or remote ModeShape JCR repository.</description>
    <url>http://www.modeshape.org</url>
    <!--
      Define the dependencies. Note that all version and scopes default to those defined in the dependencyManagement section of the
      parent pom.
    -->
    <dependencies>
        <dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
        </dependency>
        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-jdbc-local</artifactId>
        </dependency>
        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-web-jcr-rest-client</artifactId>
        </dependency>
        <!--
        Testing (note the scope)
        -->
        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-common</artifactId>
            <type>test-jar</type>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-jcr</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-jcr</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-core</artifactId>
            <version>${infinispan.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-jdbc-local</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-web-jcr-rest-war</artifactId>
            <type>war</type>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
        </dependency>
        <!--
          PicketBox (JAAS implementation used in test cases)
          -->
        <dependency>
            <groupId>org.picketbox</groupId>
            <artifactId>picketbox-bare</artifactId>
        </dependency>
        <!--
        Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing)
        -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>*</include>
                    <include>**/*</include>
                </includes>
            </resource>
            <!-- Apply the properties set in the POM to the resource files -->
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/JdbcI18n.properties</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <!--During the default test phase, excluded the Http tests which will run during the integration phase-->
                    <execution>
                        <!--The id of the default test phase of the maven plugin (do not change) -->
                        <id>default-test</id>
                        <configuration>
                            <excludes>
                                <exclude>**/*Http*Test.java</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                    <!--Execute the Http tests during the integration tests, in a running cargo container -->
                    <execution>
                        <id>integration-tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/*Http*Test.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--Configuration inherited from parent pom -->
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <configuration>
                        <deployables>
                            <!-- application to deploy (brought in as a transitive dependency of modeshape-rest-client -->
                            <deployable>
                                <groupId>org.modeshape</groupId>
                                <artifactId>modeshape-web-jcr-rest-war</artifactId>
                                <type>war</type>
                                <properties>
                                    <context>modeshape</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </configuration>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>assembly</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <!--This installs a jar which will be unpacked and processed by ANT in the modeshape-client module -->
                            <execution>
                                <id>default</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                    <descriptors>
                                        <descriptor>src/assembly/kit.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                            <!--Creates an assembly which will be included in the binary distribution -->
                            <execution>
                                <id>module-with-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptorRefs>
                                        <descriptorRef>module-with-dependencies</descriptorRef>
                                    </descriptorRefs>
                                    <archive>
                                        <manifest>
                                            <addClasspath>true</addClasspath>
                                        </manifest>
                                    </archive>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>