<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>

  <name>Errai::JPA::Client</name>

  <parent>
    <artifactId>errai-jpa-parent</artifactId>
    <groupId>org.jboss.errai</groupId>
    <version>3.1.1.Final</version>
  </parent>

  <artifactId>errai-jpa-client</artifactId>

  <dependencies>

    <!-- It is important that the Hibernate dependencies come before the GWT dependencies
         (or Errai dependencies that transitively include GWT). Otherwise, you get
         NoSuchMethodError on JPA2 calls like EntityManagerFactory.getMetamodel(). -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-ioc</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-data-binding</artifactId>
    </dependency>

    <!-- Must come after errai-common is inherited for patched JUnitShell -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava-gwt</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/java/</directory>
      </resource>
      <resource>
        <directory>src/main/resources/</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/java/</directory>
      </testResource>
      <testResource>
        <directory>src/test/resources/</directory>
      </testResource>
    </testResources>
  </build>

  <profiles>
    <profile>
      <id>integration-test</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <skipTests>false</skipTests>
              <forkMode>always</forkMode>
              <argLine>-Xms1g -Xmx1500m -XX:MaxPermSize=128m ${argLine}</argLine>

              <additionalClasspathElements>
                <additionalClasspathElement>${basedir}/target/classes/</additionalClasspathElement>
                <additionalClasspathElement>${basedir}/test-classes/</additionalClasspathElement>
                <additionalClasspathElement>${basedir}/src/test/java/</additionalClasspathElement>
              </additionalClasspathElements>
              <useSystemClassLoader>false</useSystemClassLoader>
              <useManifestOnlyJar>true</useManifestOnlyJar>

              <systemProperties>
                <property>
                  <name>java.io.tmpdir</name>
                  <value>${project.build.directory}</value>
                </property>
                <property>
                  <name>log4j.output.dir</name>
                  <value>${project.build.directory}</value>
                </property>

                <!-- Do not accidently package server test marshallers when building Errai -->
                <property>
                  <name>errai.marshalling.server.classOutput.enabled</name>
                  <value>false</value>
                </property>


                <!-- Must disable long polling for automated tests to succeed -->
                <property>
                  <name>org.jboss.errai.bus.do_long_poll</name>
                  <value>false</value>
                </property>

                <!-- Disable caching of generated code -->
                <property>
                  <name>errai.devel.nocache</name>
                  <value>true</value>
                </property>
              </systemProperties>

              <includes>
                <include>**/AllJpaTests.java</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
