<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::Data Synchronization</name>

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

    <version>2.4.0-SNAPSHOT</version>
  </parent>

  <artifactId>errai-jpa-datasync</artifactId>

  <properties>
    <version.org.jboss.jbossas>7.1.1.Final</version.org.jboss.jbossas>
  </properties>

  <dependencies>

    <!-- This dependency comes first to ensure this project doesn't see the GWT translatable
         version in errai-jpa-client on its classpath. -->
    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
      <version>1.0.1.Final</version>
      <scope>provided</scope>
    </dependency>

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

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

    <!-- Errai and GWT dependencies have to come after Arquillian -->
    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-jpa-client</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Ideally, this should be an optional dependency. We could provide different options for the datasync transport. -->
    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-bus</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Again, maybe this should be optional. The client sync manager currently uses CDI to notify locally when a sync has completed. -->
    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-cdi-client</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</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>

    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[2.1,)</versionRange>
                    <goals>
                      <goal>unpack</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>integration-test</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skipTests>false</skipTests>
              <forkMode>always</forkMode>
              <argLine>-Xms1g -Xmx1500m -XX:MaxPermSize=250m ${argLine} ${jacocoArgs}</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>

                <property>
                  <name>jbossHome</name>
                  <value>${project.build.directory}/jboss-as-${version.org.jboss.jbossas}</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>**/AllDataSyncTests.java</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
