<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</artifactId>
    <version>7.13.0.Final</version>
  </parent>

  <artifactId>jbpm-runtime-manager</artifactId>
  <packaging>bundle</packaging>

  <name>jBPM :: RuntimeManager</name>
  <description>jBPM RuntimeManager</description>
  
  <properties>
    <java.module.name>org.jbpm.runtime.manager</java.module.name>

    <maven.hibernate.dialect>org.hibernate.dialect.H2Dialect</maven.hibernate.dialect>
    <maven.datasource.classname>org.h2.jdbcx.JdbcDataSource</maven.datasource.classname>
    <maven.jdbc.driver.class>org.h2.Driver</maven.jdbc.driver.class>
    <maven.jdbc.db.name/>
    <maven.jdbc.db.port/>
    <maven.jdbc.db.server/> 
    <maven.jdbc.url>jdbc:h2:mem:jbpm-db;MVCC=true</maven.jdbc.url>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie.soup</groupId>
      <artifactId>kie-soup-project-datamodel-commons</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-compiler</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-persistence-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-persistence-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-flow</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-bpmn2</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-persistence-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-audit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-ci</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-internal</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mvel</groupId>
      <artifactId>mvel2</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-core</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- cdi -->
    <dependency>
      <groupId>org.jboss.spec.javax.el</groupId>
      <artifactId>jboss-el-api_3.0_spec</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-human-task-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-human-task-workitems</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-human-task-audit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-human-task-jpa</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>javax.el</groupId>
          <artifactId>javax.el-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.interceptor</groupId>
          <artifactId>javax.interceptor-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    
    <!-- Test -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-test-util</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-flow-builder</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.ejb</groupId>
      <artifactId>jboss-ejb-api_3.2_spec</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.jms</groupId>
      <artifactId>jboss-jms-api_2.0_spec</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-decisiontables</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <!-- Classes from stax-api are already present in 'xml-apis:xml-apis' dependency -->
          <groupId>javax.xml.stream</groupId>
          <artifactId>stax-api</artifactId>
        </exclusion>
        <exclusion>
          <!-- Not needing for testing -->
          <groupId>org.apache.xmlbeans</groupId>
          <artifactId>xmlbeans</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

    <!--  Test: persistence -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-persistence-jpa</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</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>
  
  <!--  byteman deps for testing -->
    <dependency>
      <groupId>org.jboss.byteman</groupId>
      <artifactId>byteman</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.byteman</groupId>
      <artifactId>byteman-submit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.byteman</groupId>
      <artifactId>byteman-install</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.byteman</groupId>
      <artifactId>byteman-bmunit</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>
        <!-- we need to fork always as we have mixture of both arquillian tests and regular
      and to avoid clashing between them as both need to setup data source and bound it to JNDI -->
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkMode>always</forkMode>
          <!-- Properties for Byteman which allows it to run on IBM Java as well -->
          <argLine>
            -javaagent:${project.build.directory}/agents/byteman.jar=port:9091,boot:${project.build.directory}/agents/byteman.jar
          </argLine>
          <systemPropertyVariables>
            <org.jboss.byteman.contrib.bmunit.agent.inhibit>true</org.jboss.byteman.contrib.bmunit.agent.inhibit>
            <org.jboss.byteman.allow.config.update>true</org.jboss.byteman.allow.config.update>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <!-- Byteman jar is copied to target/agents directory so Java is able to bootstrap it -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-agent</id>
            <phase>process-test-classes</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.jboss.byteman</groupId>
                  <artifactId>byteman</artifactId>
                  <outputDirectory>${project.build.directory}/agents</outputDirectory>
                  <destFileName>byteman.jar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Import-Package>
              !org.jbpm.runtime.manager*,
              javassist.util.proxy;resolution:=optional,
              javax.enterprise.context,
              javax.enterprise.context.spi,
              javax.enterprise.inject,
              javax.enterprise.inject.spi,
              javax.enterprise.util,
              javax.inject,
              javax.naming,
              javax.persistence,
              javax.xml,
              javax.xml.bind,
              javax.xml.bind.annotation,
              javax.xml.validation,
              org.drools.compiler.kie.builder.impl,
              org.drools.compiler.kie.util,
              org.drools.core.builder.conf.impl,
              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,
              org.drools.core.time,
              org.drools.core.time.impl,
              org.drools.core.util,
              org.drools.persistence,
              org.drools.persistence.api,
              org.drools.persistence.jpa,
              org.drools.persistence.jta,
              org.jboss.solder.core;resolution:=optional,
              org.jbpm.marshalling.impl,
              org.jbpm.persistence.api,
              org.jbpm.persistence.timer,
              org.jbpm.process.audit,
              org.jbpm.process.audit.event,
              org.jbpm.process.core.timer,
              org.jbpm.process.core.timer.impl,
              org.jbpm.process.instance,
              org.jbpm.process.instance.event,
              org.jbpm.process.instance.event.listeners,
              org.jbpm.process.instance.impl,
              org.jbpm.process.instance.timer,
              org.jbpm.services.task,
              org.jbpm.services.task.impl,
              org.jbpm.services.task.impl.command,
              org.jbpm.services.task.audit;resolution:=optional,
              org.jbpm.services.task.identity,
              org.jbpm.services.task.lifecycle.listeners,
              org.jbpm.services.task.wih,
              org.hibernate.proxy;resolution:=optional,
              org.kie.api,
              org.kie.api.builder,
              org.kie.api.builder.model,
              org.kie.api.command,
              org.kie.api.event.process,
              org.kie.api.event.rule,
              org.kie.api.executor,
              org.kie.api.io,
              org.kie.api.marshalling,
              org.kie.api.runtime,
              org.kie.api.runtime.conf,
              org.kie.api.runtime.manager,
              org.kie.api.runtime.manager.audit,
              org.kie.api.runtime.process,
              org.kie.api.task,
              org.kie.api.task.model,
              org.kie.internal,
              org.kie.internal.io,
              org.kie.internal.query,
              org.kie.internal.builder,
              org.kie.internal.command,
              org.kie.internal.executor.api,
              org.kie.internal.persistence.jpa,
              org.kie.internal.process,
              org.kie.internal.runtime,
              org.kie.internal.runtime.conf,
              org.kie.internal.runtime.error,
              org.kie.internal.runtime.manager,
              org.kie.internal.runtime.manager.cdi.qualifier,
              org.kie.internal.runtime.manager.context,
              org.kie.internal.task.api,
              org.kie.internal.task.api.model,
              org.kie.internal.task.query,
              org.kie.scanner;resolution:=optional,
              org.kie.spring.persistence;resolution:=optional,
              org.mvel2,
              org.slf4j,
              org.eclipse.aether.artifact;resolution:=optional,
              org.xml.sax
            </Import-Package>
            <Export-Package>
              org.jbpm.runtime.manager.api*,
              org.jbpm.runtime.manager.impl*
            </Export-Package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
