<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>camunda BPM - engine</name>
  <artifactId>camunda-engine</artifactId>

  <parent>
    <groupId>org.camunda.bpm</groupId>
    <artifactId>camunda-parent</artifactId>
    <relativePath>../parent</relativePath>
    <version>7.1.0-Final</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>
      <scope>provided</scope>
    </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>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.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>com.fasterxml.uuid</groupId>
      <artifactId>java-uuid-generator</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <!-- required for DiagramQueryTest -->
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency> 

    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-web-6.0</artifactId>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.tomcat</groupId>
      <artifactId>catalina</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.jboss</groupId>
      <artifactId>jboss-vfs</artifactId>
      <version>3.1.0.Final</version>
      <scope>provided</scope>    
    </dependency>
    
    <dependency>
      <groupId>org.camunda.bpm.model</groupId>
      <artifactId>camunda-bpmn-model</artifactId>
    </dependency>
       
  </dependencies>
  
  <properties>
      <history.level>full</history.level>
      <mail.server.port>5025</mail.server.port>
  
      <camunda.artifact>
        org.camunda.bpm
      </camunda.artifact>
      <camunda.osgi.import.defaults>
        org.camunda.bpm.model*
      </camunda.osgi.import.defaults>
      <camunda.osgi.import.additional>
          junit*;resolution:=optional,
          org.junit*;resolution:=optional,
          com.sun*;resolution:=optional,
          javax.persistence*;resolution:=optional,
          javax.servlet*;resolution:=optional,
          javax.transaction*;resolution:=optional,
          javax.ejb*;resolution:=optional,
          javax.xml*;resolution:=optional,
          javax.mail*;resolution:=optional,
          org.apache.catalina*;resolution:=optional,
          org.apache.commons.mail;resolution:=optional,
          org.apache.tools.ant*;resolution:=optional,
          org.apache.xerces*;resolution:=optional,
          org.springframework*;resolution:=optional,
          com.fasterxml*;resolution:=optional,
          org.jboss.vfs*;resolution:=optional
      </camunda.osgi.import.additional>
  </properties>

  <build>
    <!-- filter mail.server.port -->
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/camunda.cfg.xml</include>
          <include>**/*camunda.cfg.xml</include>
          <include>**/camunda.cfg.db.xml</include>
        </includes>
      </testResource>
    </testResources>
        
    <plugins>     
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <failIfNoTests>false</failIfNoTests>
          <trimStackTrace>false</trimStackTrace>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <excludes>
            <exclude>**/*TestCase.java</exclude>

            <exclude>**/RepeatingServiceTaskTest.java</exclude>
          </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>
    <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.felix</groupId>
                    <artifactId>
                      maven-bundle-plugin
                    </artifactId>
                    <versionRange>
                      [2.1.0,)
                    </versionRange>
                    <goals>
                      <goal>cleanVersions</goal>
                      <goal>manifest</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </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>
            <executions>
              <execution>
                <goals>
                  <goal>test-jar</goal>
                </goals>
              </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>
            <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>
      
      <properties>
        <db.properties.file>${user.home}/.camunda/jdbc/engine.${database}.properties</db.properties.file>
      </properties>
      
      <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 configuration to db ${database}" />
                    <copy file="target/test-classes/camunda.cfg.db.xml" tofile="target/test-classes/camunda.cfg.xml" overwrite="true">
                      <filterset filtersfile="${db.properties.file}" />
                    </copy>
                    
                    <echo message="dropping schema in ${database}" />
                    <java classname="org.camunda.bpm.engine.impl.db.DbSchemaDrop" classpathref="maven.test.classpath" />
                  </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.camunda.bpm.engine.impl.db.DbSchemaDrop" classpathref="maven.test.classpath" />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--  check history audit -->
    <profile>
      <id>cfghistoryaudit</id>
      <properties>
        <history.level>audit</history.level>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/RepeatingServiceTaskTest.java</exclude>
                <exclude>**/TaskEventsTest.java</exclude>
                <exclude>**/OperationLog*.java</exclude>
                <exclude>**/HistoricIncident*Test.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--  check history activity -->
    <profile>
      <id>cfghistoryactivity</id>
      <properties>
        <history.level>activity</history.level>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/HistoricTaskInstanceUpdateTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-485  -->
                <exclude>**/Historic*InstanceTest.java</exclude>
                <exclude>**/HistoricActivity*Test.java</exclude>
                <exclude>**/HistoryServiceTest.java</exclude>
                <exclude>**/RepeatingServiceTaskTest.java</exclude>
                <exclude>**/TaskEventsTest.java</exclude>
                <exclude>**/OperationLog*.java</exclude>
                <exclude>**/HistoricIncident*Test.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!--  check history none -->
    <profile>
      <id>cfghistorynone</id>
      <properties>
        <history.level>none</history.level>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/HistoricTaskInstanceUpdateTest.java</exclude> <!-- http://jira.codehaus.org/browse/ACT-485  -->
                <exclude>**/Historic*InstanceTest.java</exclude>
                <exclude>**/HistoricActivity*Test.java</exclude>
                <exclude>**/HistoryServiceTest.java</exclude>
                <exclude>**/RepeatingServiceTaskTest.java</exclude>
                <exclude>**/TaskEventsTest.java</exclude>
                <exclude>**/OperationLog*.java</exclude>
                <exclude>**/HistoricVariableInstanceScopeTest.java</exclude>
                <exclude>**/HistoricIncident*Test.java</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 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>ojdbc6</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
  
  <profile>
      <id>oracle10g</id>
      <activation>
        <property>
          <name>database</name>
          <value>oracle10g</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.oracle.jdbc</groupId>
          <artifactId>ojdbc14</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <failIfNoTests>false</failIfNoTests>
              <trimStackTrace>false</trimStackTrace>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
              <excludes>
                <exclude>**/ManagementServiceTest.java</exclude>    
                                
                <exclude>**/*TestCase.java</exclude>
                <exclude>**/RepeatingServiceTaskTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </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>

    <profile>
      <id>mssql</id>
        <activation>
        <property>
        <name>database</name>
        <value>mssql</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>sqljdbc4</artifactId>
        <scope>test</scope>
        </dependency>
       </dependencies>
    </profile>

    <profile>
      <id>mssql12</id>
        <activation>
        <property>
          <name>database</name>
          <value>mssql12</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.microsoft.sqlserver</groupId>
          <artifactId>sqljdbc4</artifactId>
          <scope>test</scope>
        </dependency>
       </dependencies>
    </profile>

    <profile>
      <id>mysql</id>
        <activation>
        <property>
          <name>database</name>
          <value>mysql</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <scope>test</scope>
        </dependency>
       </dependencies>
    </profile>
    
    <profile>
      <id>postgresql</id>
        <activation>
        <property>
          <name>database</name>
          <value>postgresql</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <scope>test</scope>
        </dependency>
       </dependencies>
    </profile>

    <profile>
      <id>postgresql93</id>
        <activation>
        <property>
          <name>database</name>
          <value>postgresql93</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
          <scope>test</scope>
        </dependency>
       </dependencies>
    </profile>

    <profile>
      <!-- check for official api differences between latest major release -->
      <id>check-api-compability</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>clirr-maven-plugin</artifactId>
            <configuration>
              <comparisonVersion>7.0.0-Final</comparisonVersion>
              <textOutputFile>${project.build.directory}/clirr.txt</textOutputFile>
              <failOnError>false</failOnError>
              <includes>
                <include>org/camunda/bpm/application/*</include>
                <include>org/camunda/bpm/container/*</include>
                <include>org/camunda/bpm/engine/*</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>check-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>wls-compatibility</id>
      <dependencies>
        <dependency>
          <groupId>joda-time</groupId>
          <artifactId>joda-time</artifactId>
          <version>1.2.1</version>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

</project>
