<?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/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jbpm</groupId>
    <artifactId>jbpm-persistence</artifactId>
    <version>7.20.0.Final</version>
  </parent>

  <artifactId>jbpm-persistence-jpa</artifactId>
  <packaging>bundle</packaging><!-- bundle = jar + OSGi metadata -->

  <name>jBPM :: JPA Persistence</name>
  <description>jBPM JPA Persistence</description>

  <properties>
    <java.module.name>org.jbpm.persistence.jpa</java.module.name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-internal</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-persistence-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-flow</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-persistence-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-persistence-api</artifactId>
    </dependency> 
    <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>javax.persistence-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-test-util</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-test-util</artifactId>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
    </dependency>
    
    <!-- OSGI -->
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <!-- Following 2 dependencies needed for making the build work with JDK5 -->
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-xjc</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    
    <!-- Test -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-persistence-api</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.narayana.jta</groupId>
      <artifactId>narayana-jta</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-flow-builder</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
      </testResource>
      <testResource>
        <directory>src/test/filtered-resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>

    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>hibernate3-maven-plugin</artifactId>
        <configuration>
          <components>
            <component>
              <name>hbm2ddl</name>
              <implementation>jpaconfiguration</implementation>
            </component>
          </components>
          <componentProperties>
            <persistenceUnit>org.jbpm.persistence.jpa</persistenceUnit>
            <outputfilename>schema.ddl</outputfilename>
            <drop>false</drop>
            <create>true</create>
            <export>false</export>
            <format>true</format>
          </componentProperties>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Import-Package>
              javassist.util.proxy;resolution:=optional,
              javax.persistence,
              javax.naming,
              javax.transaction.*;resolution:=optional,
              org.hibernate.proxy;resolution:=optional,
              org.hibernate.dialect;resolution:=optional,
              com.google.protobuf;resolution:=optional,
              org.drools.core.command,
              org.drools.core.command.impl,
              org.drools.core.common,
              org.drools.core.impl,
              org.drools.core.marshalling.impl,
              org.drools.core.runtime.process,
              org.drools.core.time,
              org.drools.core.time.impl,
              org.drools.persistence,
              org.drools.persistence.api,
              org.drools.persistence.jpa,
              org.drools.persistence.jta,
              org.drools.persistence.map,
              org.jbpm.marshalling.impl,
              org.jbpm.persistence.api,              
              org.jbpm.persistence.api.integration,
              org.jbpm.persistence.api.integration.base,
              org.jbpm.persistence.api.integration.model,
              org.jbpm.process.core.async,
              org.jbpm.process.core.timer,
              org.jbpm.process.core.timer.impl,
              org.jbpm.process.instance,
              org.jbpm.process.instance.event,
              org.jbpm.process.instance.impl,
              org.jbpm.process.instance.timer,
              org.jbpm.workflow.core,
              org.jbpm.workflow.instance.impl,
              org.jbpm.workflow.instance.node,
              org.kie.api,
              org.kie.api.command,
              org.kie.api.definition.process,
              org.kie.api.executor,
              org.kie.api.marshalling,
              org.kie.api.runtime,
              org.kie.api.runtime.manager,
              org.kie.api.runtime.process,
              org.kie.internal.command,
              org.kie.internal.jaxb,
              org.kie.internal.process,              
              org.kie.internal.runtime.manager,
              org.kie.internal.runtime.manager.context,
              org.slf4j
            </Import-Package>
            <Export-Package>
              org.jbpm.persistence,
              org.jbpm.persistence.jpa,
              org.jbpm.persistence.correlation,
              org.jbpm.persistence.settings,
              org.jbpm.persistence.jta,
              org.jbpm.persistence.processinstance,
              org.jbpm.persistence.timer
            </Export-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <!--  ensure that db files are deleted before _any_ run 
              otherwise we get tests failing because of leftover db's -->
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${basedir}</directory>
              <includes>
                <include>btm*</include>
                <include>*.db</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
