<?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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <artifactId>alfresco-docker-transform-misc</artifactId>
    <name>Alfresco Docker Miscellaneous Transformers</name>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-transform-core</artifactId>
        <version>2.1.0-EA4</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <properties>
        <image.name>alfresco/alfresco-transform-misc</image.name>
        <image.registry>quay.io</image.registry>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-transformer-base</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-transformer-base</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-core</artifactId>
            <!--
            TODO temp workaround for ATS-481 / REPO-4514 (exclude: dom4j.dom4j 1.6.1 / include org.dom4j.dom4j 2.1.1)
            TODO remove this workaround once transitive dependencies have been fixed (surf-core-configservice -> alfresco-core)
            -->
            <exclusions>
                <exclusion>
                    <groupId>dom4j</groupId>
                    <artifactId>dom4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>2.1.1</version>
        </dependency>

        <!-- HtmlParserContentTransformer -->
        <dependency>
            <groupId>org.htmlparser</groupId>
            <artifactId>htmlparser</artifactId>
            <version>2.1</version>
        </dependency>

        <!-- AppleIWorksContentTransformer -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
        </dependency>

        <!-- TextToPdfContentTransformer -->
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-tools</artifactId>
            <version>2.0.16</version>
        </dependency>

        <!-- OOXMLThumbnailContentTransformer -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <configuration>
                    <images>
                        <image>
                            <name>${image.name}:${image.tag}</name>
                            <build>
                                <dockerFileDir>${project.basedir}/</dockerFileDir>
                                <buildOptions>
                                    <squash>true</squash>
                                </buildOptions>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>docker-it-setup</id>
            <!-- raises an ActiveMq container for the Integration Tests -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>local</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>build-image</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>internal</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <configuration>
                            <images>
                                <!-- QuayIO image -->
                                <image>
                                    <name>${image.name}:${image.tag}</name>
                                    <registry>${image.registry}</registry>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                        <buildOptions>
                                            <squash>true</squash>
                                        </buildOptions>
                                    </build>
                                </image>
                                <!-- DockerHub image -->
                                <image>
                                    <name>${image.name}:${image.tag}</name>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                        <buildOptions>
                                            <squash>true</squash>
                                        </buildOptions>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-push-image</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>fabric8-maven-plugin</artifactId>
                        <configuration combine.self="override">
                            <images>
                                <!-- QuayIO image -->
                                <image>
                                    <name>${image.name}:${project.version}</name>
                                    <registry>${image.registry}</registry>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                        <buildOptions>
                                            <squash>true</squash>
                                        </buildOptions>
                                    </build>
                                </image>
                                <!-- DockerHub image -->
                                <image>
                                    <name>${image.name}:${project.version}</name>
                                    <build>
                                        <dockerFileDir>${project.basedir}/</dockerFileDir>
                                        <buildOptions>
                                            <squash>true</squash>
                                        </buildOptions>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-push-image</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>