<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>Activiti - Engine</name>
  <groupId>org.activiti</groupId>
  <artifactId>activiti-engine</artifactId>

  <parent>
    <groupId>org.activiti</groupId>
    <artifactId>activiti-root</artifactId>
    <relativePath>../..</relativePath>
    <version>5.4</version>
  </parent>

  <dependencies>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-email</artifactId>
    </dependency>
    <dependency>
      <!-- required for building with JDK 5 -->
      <groupId>org.livetribe</groupId>
      <artifactId>livetribe-jsr223</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </dependency>
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-compiler</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.persistence</groupId>
      <artifactId>persistence-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jta_1.1_spec</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.openjpa</groupId>
        <artifactId>openjpa</artifactId>
        <scope>test</scope>
      </dependency>
    <dependency>
        <groupId>org.subethamail</groupId>
      <artifactId>subethasmtp-wiser</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>postgresql</groupId>
      <artifactId>postgresql</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.jtds</groupId>
      <artifactId>jtds</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
      <activiti.artifact>org.activiti.engine</activiti.artifact>
      <activiti.osgi.import.additional>
          junit*;resolution:=optional,
          org.junit*;resolution:=optional,
          com.sun*;resolution:=optional,
          javax.persistence*;resolution:=optional,
          org.apache.commons.mail;resolution:=optional,
          org.apache.tools.ant*;resolution:=optional,
          org.apache.xerces*;resolution:=optional,
      </activiti.osgi.import.additional>
  </properties>

  <repositories>
    <repository>
      <id>activiti</id>
      <name>Activiti</name>
      <url>http://maven.alfresco.com/nexus/content/repositories/activiti/</url>
    </repository>
  </repositories>

  <build>
    <plugins>      
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*TestCase.java</exclude>
            <exclude>**/CompetingJobAcquisitionTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-234 -->
            <exclude>**/WSDLImporterTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-315 -->
            <exclude>**/JobExecutorTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-427 -->
            <exclude>**/HistoricTaskInstanceUpdateTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-485  -->
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>
      <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
          <executions>
              <execution>
                  <phase>generate-sources</phase>
                  <goals>
                      <goal>cleanVersions</goal>
                  </goals>
              </execution>
        <execution>
          <id>bundle-manifest</id>
          <phase>process-classes</phase>
          <goals>
            <goal>manifest</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    </plugins>
  </build>

  <profiles>
  
    <profile>
      <id>checkspring</id>
      <properties>
        <skipTests>true</skipTests>
      </properties>
    </profile>
    
    <profile>
      <id>create-test-jar</id>
      <build>
        <plugins>
		      <plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-jar-plugin</artifactId>
		        <version>2.2</version>
		        <executions>
		          <execution>
		            <goals>
		              <goal>test-jar</goal>
		            </goals>
		          </execution>
		        </executions>
		      </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <id>remove-meta-inf-persistence-xml</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <!-- this will prevent that the persistence.xml causes trouble on jboss continuous integration testing -->
                    <delete dir="target/test-classes/META-INF" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>upgradeDatabase</id>
      <activation>
        <property>
          <name>upgradeDatabase</name>
        </property>
      </activation>
      <properties>
        <skipTests>true</skipTests>
      </properties>
    </profile>
    <profile>
      <id>distro</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    
    <!--  database qa profile -->
    <profile>
      <id>database</id>
      <activation>
        <property>
          <name>database</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <!--
              only worked with this version, there might be a bug with antrun
              see http://jira.codehaus.org/browse/MANTRUN-109
            -->
            <version>1.4</version>
            <executions>
              <execution>
                <id>database-test-create-schema</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="updating activiti configuration to db ${database}" />
                    <copy file="${basedir}/../../qa/db/activiti.cfg.xml" todir="target/test-classes" overwrite="true">
                      <filterset filtersfile="${user.home}/.activiti/jdbc/build.${database}.properties" />
                    </copy>
                  </tasks>
                </configuration>
              </execution>
              <execution>
                <id>database-test-drop-schema</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="dropping schema in ${database}" />
                    <java classname="org.activiti.engine.impl.db.DbSchemaDrop" classpathref="maven.test.classpath" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--  check history full -->
    <profile>
      <id>cfghistoryfull</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <id>database-test-create-schema</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="updating activiti configuration to qa/cfg/historyfull.activiti.cfg.xml" />
                    <copy file="${basedir}/../../qa/cfg/historyfull.activiti.cfg.xml" tofile="target/test-classes/activiti.cfg.xml" overwrite="true" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/CompetingJobAcquisitionTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-234 -->
                <exclude>**/WSDLImporterTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-315 -->
                <exclude>**/JobExecutorTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-427 -->
                <exclude>**/HistoricTaskInstanceUpdateTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-485  -->
                
                <exclude>org/activiti/standalone/**</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--  check history full -->
    <profile>
      <id>cfghistoryaudit</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <id>database-test-create-schema</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="updating activiti configuration to qa/cfg/historyaudit.activiti.cfg.xml" />
                    <copy file="${basedir}/../../qa/cfg/historyaudit.activiti.cfg.xml" tofile="target/test-classes/activiti.cfg.xml" overwrite="true" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/CompetingJobAcquisitionTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-234 -->
                <exclude>**/WSDLImporterTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-315 -->
                <exclude>**/JobExecutorTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-427 -->
                <exclude>**/HistoricTaskInstanceUpdateTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-485  -->
                
                <exclude>org/activiti/standalone/**</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--  check history none -->
    <profile>
      <id>cfghistorynone</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <id>database-test-create-schema</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="updating activiti configuration to qa/cfg/historynone.activiti.cfg.xml" />
                    <copy file="${basedir}/../../qa/cfg/historynone.activiti.cfg.xml" tofile="target/test-classes/activiti.cfg.xml" overwrite="true" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/CompetingJobAcquisitionTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-234 -->
                <exclude>**/WSDLImporterTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-315 -->
                <exclude>**/JobExecutorTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-427 -->
                <exclude>**/HistoricTaskInstanceUpdateTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-485  -->
                
                <exclude>**/Historic*InstanceTest.java</exclude>
                <exclude>**/HistoryServiceTest.java</exclude>
                <exclude>org/activiti/standalone/**</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>testSchemaMetaData</id>
      <activation>
        <property>
          <name>metadatabase</name>
        </property>
      </activation>
      <build>
        <plugins>
		      <plugin>
		        <artifactId>maven-surefire-plugin</artifactId>
		        <configuration>
              <includes>
                <include>**/JdbcMetaDataTest.java</include>
              </includes>
		          <excludes />
		        </configuration>
		      </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.4</version>
            <executions>
              <execution>
                <id>database-test-create-schema</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="creating db schema in ${metadatabase}" />
                    <ant antfile="${basedir}/../../qa/db/build.xml" target="create.db.schema">
                      <property name="test_classpath" refid="maven.test.classpath" />
                      <property name="database" value="${metadatabase}" />
                    </ant>
                    <echo message="updating activiti cfg to ${metadatabase}" />
                    <ant antfile="${basedir}/../../qa/db/build.xml" target="create.activiti.cfg">
                      <property name="database" value="${metadatabase}" />
                    </ant>
                  </tasks>
                </configuration>
              </execution>
              <execution>
                <id>database-test-drop-schema</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="dropping schema in ${metadatabase}" />
                    <ant antfile="${basedir}/../../qa/db/build.xml" target="drop.db.schema"
                      inheritAll="false">
                      <property name="test_classpath" refid="maven.test.classpath" />
                      <property name="database" value="${metadatabase}" />
                    </ant>
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>oracle</id>
      <activation>
        <property>
          <name>database</name>
          <value>oracle</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.oracle.jdbc</groupId>
          <artifactId>ojdbc5</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    
    <profile>
      <id>db2</id>
      <activation>
        <property>
          <name>database</name>
          <value>db2</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.ibm.db2.jcc</groupId>
          <artifactId>db2jcc4</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <excludePackageNames>org.activiti.impl*,org.activiti.engine.impl*</excludePackageNames>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

</project>
