<?xml version="1.0"?>
<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.camunda.bpm.cycle</groupId>
    <artifactId>camunda-cycle-root</artifactId>
    <version>3.1.0</version>
  </parent>

  <artifactId>camunda-cycle</artifactId>
  <packaging>war</packaging>
  <name>camunda BPM - cycle - app</name>
  
  <properties>
    <web.resources.override>src/main/runtime/default/webapp</web.resources.override>
    <java.resources.override>src/main/runtime/default/resources</java.resources.override>
    <properties.override>src/main/runtime/default/config.properties</properties.override>
  </properties>
  
  <dependencies>
    <!-- Spring Framework -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
    </dependency>

    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjweaver</artifactId>
      <version>1.7.0</version>
    </dependency>
	<dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>1.7.0</version>
    </dependency>
    

    <!-- Java EE APIs not provided on tomcat -->
    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.annotation</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
    </dependency>
    <!-- persistence -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
    </dependency>
    <!-- CGLIB for various things including @Transactional and spring-data-jpa -->
    <dependency>
      <groupId>cglib</groupId>
      <artifactId>cglib</artifactId>
    </dependency>
    <!-- rest -->
    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-json</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sun.jersey.contribs</groupId>
      <artifactId>jersey-spring</artifactId>
      <!-- exclude spring because of old versions -->
      <exclusions>
        <exclusion>
          <artifactId>spring-core</artifactId>
          <groupId>org.springframework</groupId>
        </exclusion>
        <exclusion>
          <artifactId>spring-beans</artifactId>
          <groupId>org.springframework</groupId>
        </exclusion>
        <exclusion>
          <artifactId>spring-context</artifactId>
          <groupId>org.springframework</groupId>
        </exclusion>
        <exclusion>
          <artifactId>spring-web</artifactId>
          <groupId>org.springframework</groupId>
        </exclusion>
        <exclusion>
          <artifactId>spring-aop</artifactId>
          <groupId>org.springframework</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${version.servlet-api}</version>
      <scope>provided</scope>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jcl</artifactId>
      <version>1.6.6</version>
    </dependency>

    <!-- templating -->
    <dependency>
      <groupId>org.thymeleaf</groupId>
      <artifactId>thymeleaf</artifactId>
      <version>${version.thymeleaf}</version>
    </dependency>
    <dependency>
      <groupId>org.thymeleaf</groupId>
      <artifactId>thymeleaf-spring3</artifactId>
      <version>${version.thymeleaf}</version>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.nekohtml</groupId>
      <artifactId>nekohtml</artifactId>
    </dependency>
    <!-- required for i18n with GNU gettext -->
    <dependency>
      <groupId>com.googlecode.gettext-commons</groupId>
      <artifactId>gettext-commons</artifactId>
      <version>0.9.8</version>
    </dependency>

    <!-- saxon for XSLT transformations (roundtrip) -->
    <dependency>
      <groupId>net.sourceforge.saxon</groupId>
      <artifactId>saxon</artifactId>
      <version>${version.saxon}</version>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.saxon</groupId>
      <artifactId>saxon</artifactId>
      <version>${version.saxon}</version>
      <classifier>dom</classifier>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.saxon</groupId>
      <artifactId>saxon</artifactId>
      <version>${version.saxon}</version>
      <classifier>xpath</classifier>
    </dependency>

    <!-- commons vfs for fs connector -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-vfs2</artifactId>
      <version>2.0</version>
      <exclusions>
        <exclusion>
          <artifactId>maven-scm-api</artifactId>
          <groupId>org.apache.maven.scm</groupId>
        </exclusion>
        <exclusion>
          <artifactId>maven-scm-provider-svnexe</artifactId>
          <groupId>org.apache.maven.scm</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <!-- encryption library -->
    <dependency>
      <groupId>org.jasypt</groupId>
      <artifactId>jasypt</artifactId>
      <version>1.8</version>
    </dependency>
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcpg-jdk15on</artifactId>
    </dependency>

    <!-- required for SignavioClient -->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>fluent-hc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpmime</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.6</version>
    </dependency>
    
    <!-- required for SvnConnector -->
    <dependency>
      <groupId>org.tigris.subversion</groupId>
      <artifactId>svnclientadapter</artifactId>
      <version>0.9.100</version>
    </dependency>
    <dependency>
      <groupId>org.tmatesoft.svnkit</groupId>
      <artifactId>svnkit-javahl16</artifactId>
      <version>1.8.6</version>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easytesting</groupId>
      <artifactId>fest-assert-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kubek2k</groupId>
      <artifactId>springockito-annotations</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- for testing the email service -->
    <dependency>
      <groupId>org.subethamail</groupId>
      <artifactId>subethasmtp-wiser</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- required for SignavioConnectorIT -->
    <dependency>
      <groupId>xmlunit</groupId>
      <artifactId>xmlunit</artifactId>
      <version>1.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>spring-beans</artifactId>
          <groupId>org.springframework</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- required for Git-Connector -->
    <dependency>
      <groupId>org.eclipse.jgit</groupId>
      <artifactId>org.eclipse.jgit</artifactId>
      <version>3.1.0.201310021548-r</version>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>1.4.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <finalName>cycle</finalName>

    <filters>
      <filter>src/test/resources/config/test.properties</filter>
      <filter>src/main/runtime/default/config.properties</filter>
      <filter>src/main/runtime/tomcat/config/database.properties</filter>
    </filters>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>${java.resources.override}</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>../cycle/src/main/runtime/tomcat/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
      <testResource>
        <directory>src/test/javascript</directory>
      </testResource>
    </testResources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>create-jar</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <forceCreation>true</forceCreation>
              <classifier>core</classifier>
              <includes>
                <include>**/org/camunda/bpm/cycle/**</include>
                <include>**/org/camunda/bpm/cycle/web/dto/*</include>
                <include>**/org/camunda/bpm/security/**</include>
              </includes>
              <excludes>
                <exclude>**/org/camunda/bpm/cycle/web/*</exclude>
                <exclude>**/org/camunda/bpm/cycle/web/filter/**</exclude>
                <exclude>**/org/camunda/bpm/cycle/web/jaxrs/**</exclude>
                <exclude>**/org/camunda/bpm/cycle/web/service/**</exclude>
              </excludes>
            </configuration>
          </execution>
          <execution>
            <id>create-test-jar</id>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <forceCreation>true</forceCreation>
              <includes>
                <include>**/org/camunda/bpm/cycle/connector/test/util/RepositoryUtil.*</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <resource>
              <filtering>true</filtering>
              <directory>src/main/webapp</directory>
              <!-- no filtering for favicon because linux destroys images through carriage return -->
              <excludes>
                <exclude>assets/img/favicon.ico</exclude>
              </excludes>
            </resource>
          </webResources>
        </configuration>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <runOrder>alphabetical</runOrder>
          <excludes>
            <!-- skip signavio connector test in default profile -->
            <exclude>**/SignavioConnectorTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>
         
    </plugins>
  </build>
  
  <profiles>
    <profile>
      <id>distro</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/AbstractConnectorTestBase.java</exclude>
                <exclude>**/SvnConnectorTest.java</exclude>
                <exclude>**/VfsConnectorTest.java</exclude>
                <exclude>**/SignavioConnectorTest.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    
    <!-- enables signavio integration test -->
    <profile>
      <id>signavio</id>
      <build>
        <plugins>          
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                 <exclude>none</exclude>
              </excludes>
              <includes>
                  <include>**/SignavioConnectorTest.java</include>
              </includes>              
            </configuration>
            <executions>
              <execution>
                <id>test-signavio-connector</id>
                <phase>test</phase>
                <goals>
                  <goal>test</goal>
                </goals>                
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/SignavioClientProxyIT.java</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>proxy</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/SignavioClientProxyIT.java</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>develop</id>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>javax.mail</groupId>
          <artifactId>mail</artifactId>
          <scope>compile</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.tomcat</groupId>
          <artifactId>tomcat-jdbc</artifactId>
          <version>7.0.50</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <!-- required for i18n with GNU gettext -->
            <!-- run 'mvn gettext:gettext gettext:merge gettext:dist' to update po 
              files and generate a updated message bundle class -->
            <groupId>com.googlecode.gettext-commons</groupId>
            <artifactId>gettext-maven-plugin</artifactId>
            <version>1.2.4</version>
            <configuration>
              <!-- Unix shellscript that runs xgettext and parses views -->
              <xgettextCmd>${basedir}/src/main/po/xgettext.sh</xgettextCmd>
              <!-- directory, into which message catalogs will be generated -->
              <poDirectory>${basedir}/src/main/po</poDirectory>
              <!-- same as AbstractI18n.getMessageBundleName() -->
              <targetBundle>i18n.Messages</targetBundle>
              <!-- directory, into which resource bundles will be generated -->
              <outputDirectory>${basedir}/src/main/resources</outputDirectory>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <executions>
              <execution>
                <id>tomcat-run</id>
                <goals>
                  <goal>exec-war-only</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <path>cycle</path>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <maven.tomcat.additionalConfigFilesDir>${basedir}/src/main/runtime/tomcat/config</maven.tomcat.additionalConfigFilesDir>
      </properties>
    </profile>
  </profiles>

</project>
