<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 Cloud</name>
  <description>Activiti Cloud (Parent)</description>
  <groupId>org.activiti.cloud</groupId>
  <artifactId>activiti-cloud-parent</artifactId>
  <version>7-201708-EA</version>

  <packaging>pom</packaging>

  <properties>
    <version.activiti>${project.version}</version.activiti>
    <version.activiti.cloud>${project.version}</version.activiti.cloud>
    <!-- Spring Boot / Cloud / Stream deps -->
    <spring.boot.version>2.0.0.M3</spring.boot.version>
    <spring.cloud.version>Finchley.M2</spring.cloud.version>
    <spring.cloud.stream.version>Ditmars.M2</spring.cloud.stream.version>
    <!-- using SNAPSHOT version to benefit from https://github.com/spring-projects/spring-hateoas/issues/583 -->
    <spring.hateoas.version>0.24.0.BUILD-SNAPSHOT</spring.hateoas.version>

    <!--configuration properties-->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <enforcer.failOnDuplicatedClasses>true</enforcer.failOnDuplicatedClasses>
    <jdk.version>1.8</jdk.version>

    <h2.version>1.4.193</h2.version>

    <!-- plugins -->
    <maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
    <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
    <maven-failsafe-plugin.version>2.20</maven-failsafe-plugin.version>
    <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
    <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
    <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
    <maven.enforcer.plugin.version>1.4.1</maven.enforcer.plugin.version>
    <maven.docker.plugin.version>0.21.0</maven.docker.plugin.version>
    <jacoco.maven.plugin.version>0.7.9</jacoco.maven.plugin.version>
    <extra-enforcer-rules.version>1.0-beta-6</extra-enforcer-rules.version>
    <illegal-transitive-dependency-check.version>1.7.4</illegal-transitive-dependency-check.version>
    <spring-boot-maven-plugin.version>1.5.4.RELEASE</spring-boot-maven-plugin.version>
    <docker.maven.plugin.version>0.21.0</docker.maven.plugin.version>
    <directory.maven.plugin.version>0.1</directory.maven.plugin.version>
    <springfox.version>2.7.0</springfox.version>
    <mockito.version>2.7.22</mockito.version>
    <junit.version>4.12</junit.version>
    <assertj.version>3.8.0</assertj.version>
    <jsonunit.version>1.24.0</jsonunit.version>
    <build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
    <assertions-generator-plugin.version>2.0.0</assertions-generator-plugin.version>

    <!-- configuration properties for tests-->
    <generated-assertions-folder>${project.build.directory}/generated-test-sources/assertions</generated-assertions-folder>
    <generated-assertions-package>org.activiti.test</generated-assertions-package>
  </properties>

  <distributionManagement>
    <!--<repository>-->
    <!--<id>central-releases-staging</id>-->
    <!--<name>Central Releases - Staging</name>-->
    <!--<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>-->
    <!--</repository>-->
    <repository>
      <id>activiti-enterprise-snapshots</id>
      <name>Activiti Snapshots</name>
      <url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases/</url>
    </repository>
    <snapshotRepository>
      <id>activiti-enterprise-snapshots</id>
      <name>Activiti Snapshots</name>
      <url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>
  
  <repositories>
    <repository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/libs-milestone</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/libs-snapshot</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>jboss-thirdparty-releases</id>
      <name>JBOSS Maven Repository</name>
      <url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>
  <!-- Here we add 3rd Party Dependencies -->
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-dependencies</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <!-- Activiti Cloud Modules for managed dependencies -->
      <dependency>
        <groupId>org.activiti.cloud</groupId>
        <artifactId>activiti-cloud-starter-runtime-bundle</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.activiti.cloud</groupId>
        <artifactId>activiti-cloud-starter-configure</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.activiti.cloud</groupId>
        <artifactId>activiti-cloud-starter-audit</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.activiti.cloud</groupId>
        <artifactId>activiti-cloud-starter-query</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.activiti.cloud</groupId>
        <artifactId>activiti-cloud-starter-test</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
      </dependency>
      <!-- Spring Boot / Cloud / Stream dependencies -->
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring.cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-dependencies</artifactId>
        <version>${spring.cloud.stream.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.hateoas</groupId>
        <artifactId>spring-hateoas</artifactId>
        <version>${spring.hateoas.version}</version>
      </dependency>

      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-core</artifactId>
        <version>${springfox.version}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-spi</artifactId>
        <version>${springfox.version}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-spring-web</artifactId>
        <version>${springfox.version}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>${springfox.version}</version>
      </dependency>
      <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>${springfox.version}</version>
      </dependency>


      <!-- Test -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-cloud-starters-tests</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>net.javacrumbs.json-unit</groupId>
        <artifactId>json-unit-fluent</artifactId>
        <version>${jsonunit.version}</version>
        <scope>test</scope>
      </dependency>


      <!-- TEST(DB) -->
      <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>${h2.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <source>${jdk.version}</source>
          <target>${jdk.version}</target>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
          <optimize>true</optimize>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
        <version>1.0.0</version>
        <configuration>
          <lifecycleMappingMetadata>
            <pluginExecutions>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>org.commonjava.maven.plugins</groupId>
                  <artifactId>directory-maven-plugin</artifactId>
                  <versionRange>[0.1,)</versionRange>
                  <goals>
                    <goal>highest-basedir</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <execute>
                    <runOnIncremental>true</runOnIncremental>
                    <runOnConfiguration>true</runOnConfiguration>
                  </execute>
                </action>
              </pluginExecution>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <versionRange>[1.5.0,)</versionRange>
                  <goals>
                    <goal>java</goal>
                    <goal>exec</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <execute>
                    <runOnIncremental>true</runOnIncremental>
                    <runOnConfiguration>true</runOnConfiguration>
                  </execute>
                </action>
              </pluginExecution>
              <pluginExecution>
                <pluginExecutionFilter>
                  <groupId>org.assertj</groupId>
                  <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
                  <versionRange>[2.0.0,)</versionRange>
                  <goals>
                    <goal>generate-assertions</goal>
                  </goals>
                </pluginExecutionFilter>
                <action>
                  <execute>
                    <runOnIncremental>true</runOnIncremental>
                    <runOnConfiguration>true</runOnConfiguration>
                  </execute>
                </action>
              </pluginExecution>
            </pluginExecutions>
          </lifecycleMappingMetadata>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <failIfNoTests>false</failIfNoTests>
          <trimStackTrace>false</trimStackTrace>
          <excludes>
            <exclude>**/*TestCase.java</exclude>
            <exclude>**/*IT.java</exclude>
          </excludes>
          <runOrder>alphabetical</runOrder>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.maven.plugin.version}</version>
        <executions>
          <!-- Unit tests configuration-->
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <!-- Integration tests configuration-->
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent-integration</goal>
            </goals>
          </execution>
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report-integration</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <additionalparam>-Xdoclint:none</additionalparam>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
          <configuration>
            <releaseProfiles>sign</releaseProfiles>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <tagNameFormat>activiti-@{project.version}</tagNameFormat>
            <!-- Necessary until keycloak releases boot2 adaptor -->
            <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven.enforcer.plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>${extra-enforcer-rules.version}</version>
            </dependency>
            <dependency>
              <groupId>de.is24.maven.enforcer.rules</groupId>
              <artifactId>illegal-transitive-dependency-check</artifactId>
              <version>${illegal-transitive-dependency-check.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>enforce-plugin-versions</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requirePluginVersions>

                  </requirePluginVersions>
                </rules>
              </configuration>
            </execution>
            <execution>
              <id>enforce-direct-dependencies</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <illegalTransitiveDependencyCheck implementation="de.is24.maven.enforcer.rules.IllegalTransitiveDependencyCheck">
                    <regexIgnoredClasses combine.children="append">
                      <!-- The marshalling classes are generated by Errai during GWT compilation. These classes
                                                 usually contain references to other dependencies which are not part of the project
                                                 (transitive dependencies), which then results in the dependency check failure.
                                                 From the maintenance point of view, ignoring these generated classes seems like the
                                                 best option. -->
                      <!-- The enforcer is complaining about Predicate class after adding the dependency to Swagger.
                      However this class is never referenced directly in the project: we are adding it to ignore list
                      to avoid a dependency that's not necessary.-->
                      <regexIgnoredClass>com\.google\.common\.base\.Predicate</regexIgnoredClass>
                    </regexIgnoredClasses>
                    <suppressTypesFromJavaRuntime>true</suppressTypesFromJavaRuntime>
                    <useClassesFromLastBuild>true</useClassesFromLastBuild>
                  </illegalTransitiveDependencyCheck>
                </rules>
              </configuration>
            </execution>
            <execution>
              <id>ban-blacklisted-dependencies</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <bannedDependencies>
                    <excludes combine.children="append">
                      <!-- Ban blacklisted logging deps (we only use SLF4J + Logback) -->
                      <!-- In case of transitive dependency, exclude it and use 'org.slf4j:jcl-over-slf4j' instead -->
                      <exclude>commons-logging:commons-log*</exclude>
                      <!-- In case of transitive dependency, exclude it and use 'org.slf4j:log4j-over-slf4j' instead -->
                      <!--<exclude>log4j:log4j</exclude>-->
                      <!-- In case of transitive dependency, exclude it and use 'org.javassist:javassist' instead -->
                      <exclude>javassist:javassist</exclude>
                    </excludes>
                  </bannedDependencies>
                </rules>
                <fail>true</fail>
              </configuration>
            </execution>
            <execution>
              <id>ban-duplicated-classes</id>
              <!-- Using phase=none as we don't want this execution as part of the default build. The phase
                                 is specified in the "full" profile and thus the execution will only be activated when using that profile. -->
              <phase>none</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <banDuplicateClasses>
                    <ignoreClasses>
                      <!-- Servlet API is bundled in way too many different dependencies, causing nightmares trying to
                                                 properly exclude everything. There were no real issues with this so far as mostly the APIs
                                                 are just duplicates of the exactly same sources. In ideal world, this get eventually fixed,
                                                 but it may very well not be worth the effort. -->
                      <ignoreClass>javax.servlet.*</ignoreClass>
                      <!-- Classes in javax.annotation package are just marker annotations used to aid the programmers.
                                                 These annotations do not influence the actual behavior of the code, so it's reasonable to
                                                 ignore them. Following dependencies contain these classes: 'com.google.code.findbugs:jsr305'
                                                 and 'com.google.code.findbugs:annotations'. -->
                      <ignoreClass>javax.annotation.*</ignoreClass>
                      <!-- Exactly the same case as for above 'javax.annotation.*' classes. Following dependencies contain
                                                 these classes: 'net.jcip:jcip-annotations' and 'com.google.code.findbugs:annotations'. -->
                      <ignoreClass>net.jcip.annotations.*</ignoreClass>
                    </ignoreClasses>
                    <dependencies>

                    </dependencies>
                    <findAllDuplicates>true</findAllDuplicates>
                  </banDuplicateClasses>
                </rules>
                <fail>${enforcer.failOnDuplicatedClasses}</fail>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <executions>
            <execution>
              <id>validate</id>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <checkstyleRules>
                  <module name="Checker">
                    <!-- Checks for whitespace. -->
                    <module name="FileTabCharacter">
                      <property name="severity" value="error" />
                      <property name="eachLine" value="true" />
                    </module>
                    <module name="TreeWalker">
                      <!-- Import settings: getting rid of redundant import, forbid star notation, defined order of imports. -->
                      <module name="RedundantImport" />
                      <module name="AvoidStarImport">
                        <property name="excludes" value="org.junit.Assert,org.assertj.core.api.Assertions,org.mockito.Mockito" />
                        <property name="allowClassImports" value="false" />
                        <property name="allowStaticMemberImports" value="false" />
                      </module>
                      <module name="CustomImportOrder">
                        <property name="customImportOrderRules" value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###STATIC" />
                        <property name="sortImportsInGroupAlphabetically" value="true" />
                        <property name="separateLineBetweenGroups" value="true" />
                      </module>

                      <module name="NeedBraces">
                        <property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO" />
                      </module>
                      <module name="EqualsHashCode" />
                    </module>
                  </module>
                </checkstyleRules>
                <outputFile>${project.build.directory}/checkstyle.log</outputFile>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
                <includeResources>true</includeResources>
                <includeTestResources>true</includeTestResources>
                <consoleOutput>false</consoleOutput>
                <logViolationsToConsole>${checkstyle.logViolationsToConsole}</logViolationsToConsole>
                <failsOnError>false</failsOnError>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-failsafe-plugin.version}</version>
          <executions>
            <execution>
              <id>integration-test</id>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>${build-helper-maven-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.commonjava.maven.plugins</groupId>
          <artifactId>directory-maven-plugin</artifactId>
          <version>${directory.maven.plugin.version}</version>
          <executions>
            <execution>
              <id>directories</id>
              <goals>
                <goal>highest-basedir</goal>
              </goals>
              <phase>initialize</phase>
              <configuration>
                <property>main.basedir</property>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>${spring.boot.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.assertj</groupId>
          <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
          <version>${assertions-generator-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.assertj</groupId>
              <artifactId>assertj-core</artifactId>
              <version>${assertj.version}</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <!-- Profile to sign artifacts, triggered when releasing -->
    <profile>
      <id>sign</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
