<?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>
  <parent>
    <groupId>com.nitorcreations</groupId>
    <artifactId>willow-parent</artifactId>
    <version>2.0.2</version>
    <relativePath>..</relativePath>
  </parent>
  <artifactId>willow-deployer</artifactId>
  <packaging>jar</packaging>
  <name>Willow deployer</name>
  <description>Willow elastic cloud application deployer</description>
  <dependencies>
    <dependency>
      <groupId>org.apache.velocity</groupId>
      <artifactId>velocity</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-util</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-connector-basic</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-transport-file</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-transport-http</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-transport-wagon</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.aether</groupId>
      <artifactId>aether-transport-classpath</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-aether-provider</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-ssh</artifactId>
    </dependency>
    <dependency>
      <groupId>org.fusesource</groupId>
      <artifactId>sigar</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.websocket</groupId>
      <artifactId>websocket-client</artifactId>
    </dependency>
    <dependency>
      <groupId>com.nitorcreations</groupId>
      <artifactId>willow-messages</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.nitorcreations</groupId>
      <artifactId>willow-utils</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.nitorcreations</groupId>
      <artifactId>willow-sshagent-auth</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils-core</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>commons-logging</artifactId>
          <groupId>commons-logging</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>annotations</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <archive>
            <manifest>
              <mainClass>com.nitorcreations.willow.deployer.Main</mainClass>
            </manifest>
          </archive>
        </configuration>
        <executions>
          <execution>
            <phase>process-test-classes</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <activation>
        <jdk>[1.6,1.9)</jdk>
      </activation>
      <dependencies>
      <dependency>
        <groupId>com.sun</groupId>
        <artifactId>tools</artifactId>
      </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>create-script</id>
      <activation>
        <os>
          <family>unix</family>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>src/main/shell/create-script.sh</executable>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>create-batch</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>src\main\shell\create-script.cmd</executable>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>integrationtests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.9.1</version>
            <executions>
              <execution>
                <id>attach-artifacts</id>
                <phase>package</phase>
                <goals>
                  <goal>attach-artifact</goal>
                </goals>
                <configuration>
                  <artifacts>
                    <artifact>
                      <file>${project.build.directory}/deployer.sh</file>
                      <type>sh</type>
                    </artifact>
                    <artifact>
                      <file>${project.build.directory}/deployer.cmd</file>
                      <type>cmd</type>
                    </artifact>
                  </artifacts>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1.2</version>
            <executions>
              <execution>
                <id>generate-rpm</id>
                <goals>
                  <goal>attached-rpm</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <license>Apache v2.0</license>
              <distribution>Willow</distribution>
              <group>Application/System</group>
              <changelogFile>src/main/resources/changelog</changelogFile>
              <mappings>
                <mapping>
                  <directory>/usr/bin</directory>
                  <directoryIncluded>false</directoryIncluded>
                  <filemode>755</filemode>
                  <username>root</username>
                  <groupname>root</groupname>
                  <sources>
                    <source>
                      <location>target/deployer.sh</location>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/etc/bash_completion.d</directory>
                  <directoryIncluded>false</directoryIncluded>
                  <filemode>644</filemode>
                  <username>root</username>
                  <groupname>root</groupname>
                  <sources>
                    <source>
                      <location>src/main/shell/deployer-complete</location>
                    </source>
                  </sources>
                </mapping>
                <mapping>
                  <directory>/var/lib/deployer</directory>
                  <filemode>755</filemode>
                  <username>root</username>
                  <groupname>root</groupname>
                  <sources>
                    <source>
                      <location>target</location>
                      <includes>
                        <include>deployer-uber-*.jar</include>
                      </includes>
                    </source>
                  </sources>
                </mapping>
              </mappings>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>run-its</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>its-prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>merge-its</id>
                <goals>
                  <goal>merge</goal>
                </goals>
                <phase>prepare-package</phase>
                <configuration>
                  <destFile>${project.build.directory}/merged.exec</destFile>
                  <fileSets>
                    <fileSet>
                      <directory>${project.parent.build.directory}/${project.artifactId}</directory>
                      <includes>
                        <include>*.exec</include>
                      </includes>
                    </fileSet>
                    <fileSet>
                      <directory>${project.build.directory}</directory>
                      <includes>
                        <include>*.exec</include>
                      </includes>
                    </fileSet>
                  </fileSets>
                </configuration>
              </execution>
              <execution>
                <id>report-its</id>
                <goals>
                  <goal>report</goal>
                </goals>
                <configuration>
                  <dataFile>${project.build.directory}/merged.exec</dataFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
