<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <parent>
    <artifactId>aldica-parent</artifactId>
    <groupId>org.aldica</groupId>
    <version>1.0.1</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>aldica-repo-ignite-companion</artifactId>
  <name>Alternative/Alfresco Distributed Cache - Repository Ignite Companion Application</name>
  <description>Standalone Java companion application to extend the Repository cache layer and keep cached data alive even in the case of a complete Repository-tier restart</description>
  <build>
    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>.gitkeep</exclude>
        </excludes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <filtering>true</filtering>
        <directory>src/test/resources</directory>
        <excludes>
          <exclude>.gitkeep</exclude>
        </excludes>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-shade-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
                <createSourcesJar>true</createSourcesJar>
                <artifactSet>
                  <includes>
                    <include>org.alfresco:alfresco-core</include>
                    <include>org.springframework:spring-core</include>
                    <include>org.springframework:spring-context</include>
                    <include>org.springframework:spring-beans</include>
                    <include>org.springframework:spring-aop</include>
                    <include>org.springframework:spring-expression</include>
                    <include>${project.groupId}:${aldica.ignite-common.artifactId}</include>
                    <include>org.apache.ignite:ignite-core</include>
                    <include>org.apache.ignite:ignite-slf4j</include>
                    <include>javax.cache:cache-api</include>
                    <include>org.jetbrains:annotations</include>
                    <include>org.slf4j:slf4j-api</include>
                    <include>org.slf4j:jcl-over-slf4j</include>
                    <include>ch.qos.logback:logback-core</include>
                    <include>ch.qos.logback:logback-classic</include>
                  </includes>
                </artifactSet>
                <filters>
                  <filter>
                    <artifact>*:*</artifact>
                    <excludes>
                      <exclude>META-INF/MANIFEST.MF</exclude>
                    </excludes>
                  </filter>
                  <filter>
                    <artifact>org.alfresco:alfresco-core</artifact>
                    <includes>
                      <include>org/alfresco/api/AlfrescoPublicApi.class</include>
                      <include>org/alfresco/config/SystemPropertiesFactoryBean.class</include>
                      <include>org/alfresco/error/AlfrescoRuntimeException.class</include>
                      <include>org/alfresco/util/EqualsHelper.class</include>
                      <include>org/alfresco/util/Pair.class</include>
                      <include>org/alfresco/util/ParameterCheck.class</include>
                      <include>org/alfresco/util/PropertyCheck.class</include>
                    </includes>
                  </filter>
                  <filter>
                    <artifact>${project.groupId}:${aldica.ignite-common.artifactId}</artifact>
                    <excludes>
                      <exclude>org/aldica/common/ignite/web/*</exclude>
                    </excludes>
                  </filter>
                </filters>
                <transformers>
                  <transformer />
                  <transformer>
                    <resource>META-INF/spring.handlers</resource>
                  </transformer>
                  <transformer>
                    <resource>META-INF/spring.schemas</resource>
                  </transformer>
                  <transformer>
                    <resource>META-INF/spring.tooling</resource>
                  </transformer>
                  <transformer>
                    <mainClass>${project.basePackage}.Runner</mainClass>
                  </transformer>
                </transformers>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <excludes>
              <exclude>**/integration/*.java</exclude>
              <exclude>**/integration/**/*.java</exclude>
            </excludes>
            <argLine>-Xmx512M
                            -Dfile.encoding=UTF-8
                            -Djava.net.preferIPv4Stack=true
                            -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
                            -DIGNITE_QUIET=true
                            -DIGNITE_NO_ASCII=true
                            -DIGNITE_UPDATE_NOTIFIER=false
                            -DIGNITE_JVM_PAUSE_DETECTOR_DISABLED=true
                            -DIGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK=true</argLine>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <configuration>
            <includes>
              <include>**/integration/*.java</include>
              <include>**/integration/**/*.java</include>
            </includes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>docker-maven-plugin</artifactId>
          <configuration>
            <sourceDirectory>src/test/docker</sourceDirectory>
            <autoCreateCustomNetworks>true</autoCreateCustomNetworks>
            <images>
              <image />
              <image>
                <run>
                  <env>
                    <JAVA_OPTS>${docker.tests.repositoryCommonJavaOpts}
                                            -D${moduleId}.core.local.host=repository
                                            -D${moduleId}.core.public.host=${docker.tests.host.name}</JAVA_OPTS>
                  </env>
                  <ports>
                    <port>${docker.tests.repositoryPort}:8080</port>
                    <port>${docker.tests.repositoryDebugPort}:${docker.tests.repositoryDebugPort}</port>
                    <port>47100:47100</port>
                    <port>47110:47110</port>
                    <port>47120:47120</port>
                  </ports>
                  <volumes>
                    <bind>
                      <volume>${moduleId}-repository-test-contentstore:/usr/local/tomcat/alf_data</volume>
                      <volume>${project.build.directory}/docker/repository-1-logs:/usr/local/tomcat/logs</volume>
                    </bind>
                  </volumes>
                </run>
              </image>
              <image />
              <image />
              <image>
                <name>${moduleId}-companion-test</name>
                <alias>companion</alias>
                <build>
                  <from>${docker.tests.companionBaseImage}</from>
                  <skip>${docker.tests.skipCompanionImageBuild}</skip>
                  <assembly>
                    <inline>
                      <file>
                        <source>${project.build.directory}/${project.build.finalName}.jar</source>
                        <outputDirectory>.</outputDirectory>
                      </file>
                      <file>
                        <source>${project.build.directory}/${project.build.finalName}.jar</source>
                        <outputDirectory>.</outputDirectory>
                      </file>
                    </inline>
                  </assembly>
                  <workdir>/maven</workdir>
                  <cmd>
                    <shell>java -Xms512M -Xmx512M -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${docker.tests.repositoryDebugPort2} -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true -DIGNITE_QUIET=true -DIGNITE_NO_ASCII=true -DIGNITE_UPDATE_NOTIFIER=false -DIGNITE_JVM_PAUSE_DETECTOR_DISABLED=true -DIGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK=true -jar ${project.build.finalName}.jar</shell>
                  </cmd>
                </build>
                <run>
                  <ports>
                    <port>${docker.tests.repositoryDebugPort2}:${docker.tests.repositoryDebugPort2}</port>
                  </ports>
                </run>
              </image>
            </images>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-toolchains-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>de.thetaphi</groupId>
        <artifactId>forbiddenapis</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>RunIntegrationTestsWithDocker</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>build-helper-maven-plugin</artifactId>
              <executions>
                <execution>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>local-ip</goal>
                  </goals>
                  <configuration>
                    <localIpProperty>docker.tests.host.ip</localIpProperty>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>org.codehaus.gmaven</groupId>
              <artifactId>groovy-maven-plugin</artifactId>
              <executions>
                <execution>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>execute</goal>
                  </goals>
                  <configuration>
                    <source>project.properties["docker.tests.host.name"] =
                                            InetAddress.getLocalHost().getHostName().toLowerCase(Locale.ENGLISH)</source>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <executions>
                <execution>
                  <id>processIntegrationTestDockerResources</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${project.build.directory}/docker</outputDirectory>
                    <resources>
                      <resource>
                        <directory>src/test/docker</directory>
                        <filtering>true</filtering>
                      </resource>
                    </resources>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>io.fabric8</groupId>
              <artifactId>docker-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>build-test-image</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>build</goal>
                  </goals>
                </execution>
                <execution>
                  <id>start-test-containers</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>volume-create</goal>
                    <goal>start</goal>
                  </goals>
                </execution>
                <execution>
                  <id>stop-test-containers</id>
                  <phase>post-integration-test</phase>
                  <goals>
                    <goal>stop</goal>
                    <goal>remove</goal>
                    <goal>volume-remove</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <executions>
                <execution>
                  <goals>
                    <goal>integration-test</goal>
                    <goal>verify</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.codehaus.gmaven</groupId>
            <artifactId>groovy-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>StartStopTestPreparations</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <executions>
                <execution>
                  <id>processIntegrationTestDockerResources</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${project.build.directory}/docker</outputDirectory>
                    <resources>
                      <resource>
                        <directory>src/test/docker</directory>
                        <filtering>true</filtering>
                      </resource>
                    </resources>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>io.fabric8</groupId>
              <artifactId>docker-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>build-test-image</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>build</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>org.aldica</groupId>
      <artifactId>aldica-common-ignite</artifactId>
      <version>1.0.1</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.aldica</groupId>
      <artifactId>aldica-repo-ignite</artifactId>
      <version>1.0.1</version>
      <classifier>installable</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>de.acosix.alfresco.utility</groupId>
      <artifactId>de.acosix.alfresco.utility.core.repo</artifactId>
      <version>1.2.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>de.acosix.alfresco.utility</groupId>
      <artifactId>de.acosix.alfresco.utility.core.repo</artifactId>
      <version>1.2.2</version>
      <classifier>installable</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.orderofthebee.support-tools</groupId>
      <artifactId>support-tools-repo</artifactId>
      <version>1.1.0.0</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>cron-utils</artifactId>
          <groupId>com.cronutils</groupId>
        </exclusion>
        <exclusion>
          <artifactId>time4j-core</artifactId>
          <groupId>net.time4j</groupId>
        </exclusion>
        <exclusion>
          <artifactId>time4j-i18n</artifactId>
          <groupId>net.time4j</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-client</artifactId>
      <version>4.1.1.Final</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>resteasy-client-api</artifactId>
          <groupId>org.jboss.resteasy</groupId>
        </exclusion>
        <exclusion>
          <artifactId>resteasy-core-spi</artifactId>
          <groupId>org.jboss.resteasy</groupId>
        </exclusion>
        <exclusion>
          <artifactId>resteasy-core</artifactId>
          <groupId>org.jboss.resteasy</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jboss-logging</artifactId>
          <groupId>org.jboss.logging</groupId>
        </exclusion>
        <exclusion>
          <artifactId>httpclient</artifactId>
          <groupId>org.apache.httpcomponents</groupId>
        </exclusion>
        <exclusion>
          <artifactId>commons-io</artifactId>
          <groupId>commons-io</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
          <groupId>org.jboss.spec.javax.ws.rs</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxb-provider</artifactId>
      <version>4.1.1.Final</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>jboss-jaxb-api_2.3_spec</artifactId>
          <groupId>org.jboss.spec.javax.xml.bind</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jaxb-runtime</artifactId>
          <groupId>org.glassfish.jaxb</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jboss-logging</artifactId>
          <groupId>org.jboss.logging</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson2-provider</artifactId>
      <version>4.1.1.Final</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>jackson-core</artifactId>
          <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jackson-databind</artifactId>
          <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jackson-annotations</artifactId>
          <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jackson-jaxrs-json-provider</artifactId>
          <groupId>com.fasterxml.jackson.jaxrs</groupId>
        </exclusion>
        <exclusion>
          <artifactId>json-patch</artifactId>
          <groupId>com.github.fge</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jboss-logging</artifactId>
          <groupId>org.jboss.logging</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>de.acosix.alfresco.rest.client</groupId>
      <artifactId>de.acosix.alfresco.rest.client</artifactId>
      <version>0.1.0</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>javax.ws.rs-api</artifactId>
          <groupId>javax.ws.rs</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jackson-databind</artifactId>
          <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>de.acosix.alfresco.rest.client</groupId>
      <artifactId>de.acosix.alfresco.rest.client</artifactId>
      <version>0.1.0</version>
      <classifier>tests</classifier>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>javax.ws.rs-api</artifactId>
          <groupId>javax.ws.rs</groupId>
        </exclusion>
        <exclusion>
          <artifactId>jackson-databind</artifactId>
          <groupId>com.fasterxml.jackson.core</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-core</artifactId>
        <version>${alfresco.safe.core.version}</version>
        <scope>compile</scope>
        <exclusions>
          <exclusion>
            <artifactId>*</artifactId>
            <groupId>*</groupId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>${aldica.ignite-common.artifactId}</artifactId>
        <version>${project.version}</version>
        <scope>compile</scope>
        <exclusions>
          <exclusion>
            <artifactId>spring-web</artifactId>
            <groupId>org.springframework</groupId>
          </exclusion>
          <exclusion>
            <artifactId>javax.servlet-api</artifactId>
            <groupId>javax.servlet</groupId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
        <scope>compile</scope>
        <exclusions>
          <exclusion>
            <artifactId>spring-jcl</artifactId>
            <groupId>org.springframework</groupId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>de.acosix.alfresco.rest.client</groupId>
        <artifactId>de.acosix.alfresco.rest.client</artifactId>
        <version>${acosix.alfresco.client.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>de.acosix.alfresco.rest.client</groupId>
        <artifactId>de.acosix.alfresco.rest.client</artifactId>
        <version>${acosix.alfresco.client.version}</version>
        <classifier>tests</classifier>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>${aldica.ignite-common.artifactId}</artifactId>
        <version>${project.version}</version>
        <classifier>tests</classifier>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>${aldica.ignite-repo.artifactId}</artifactId>
        <version>${project.version}</version>
        <classifier>installable</classifier>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <properties>
    <project.basePackage>org.aldica.repo.ignite.companion</project.basePackage>
    <docker.tests.skipCompanionImageBuild>false</docker.tests.skipCompanionImageBuild>
    <acosix.alfresco.client.version>0.1.0</acosix.alfresco.client.version>
    <docker.tests.companionBaseImage>openjdk:8-jdk-slim</docker.tests.companionBaseImage>
  </properties>
</project>
