<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright (c) Codice Foundation
 *
 * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at
 * <http://www.gnu.org/licenses/lgpl.html>.
 *
 **/
-->
<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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>ddf.distribution</groupId>
        <artifactId>docker</artifactId>
        <version>2.30.0</version>
    </parent>
    <artifactId>ddf-solrcloud</artifactId>
    <groupId>ddf.distribution.docker</groupId>
    <packaging>pom</packaging>
    <name>DDF :: Distribution :: Docker :: SolrCloud</name>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources-filtered</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <!-- avoid directory clean failures on Windows due to exec command holding onto directory lock -->
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>up</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>docker</executable>
                            <arguments>
                                <argument>compose</argument>
                                <argument>up</argument>
                                <argument>-d</argument>
                            </arguments>
                            <workingDirectory>${project.build.outputDirectory}/solrcloud</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>logs</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                          <executable>docker</executable>
                            <arguments>
                              <argument>compose</argument>
                              <argument>logs</argument>
                                <argument>--tail=50</argument>
                                <argument>-f</argument>
                            </arguments>
                            <workingDirectory>${project.build.outputDirectory}/solrcloud</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>down</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>docker</executable>
                            <arguments>
                              <argument>compose</argument>
                              <argument>down</argument>
                            </arguments>
                            <workingDirectory>${project.build.outputDirectory}/solrcloud</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>rm</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>docker</executable>
                            <arguments>
                                <argument>volume</argument>
                                <argument>rm</argument>
                                <argument>solr1_data</argument>
                                <argument>solr2_data</argument>
                                <argument>zoo_data</argument>
                                <argument>zoo_datalog</argument>
                            </arguments>
                            <workingDirectory>${project.build.outputDirectory}/solrcloud</workingDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <includeEmptyDirs>true</includeEmptyDirs>
                    <escapeString>_DO_NOT_EXPAND_</escapeString>
                </configuration>
                <executions>
                    <execution>
                        <id>filter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
