<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>
  <groupId>io.hops</groupId>
  <artifactId>hopsworks-cli</artifactId>
  <version>0.1</version>
  <packaging>jar</packaging>

  <name>hopsworks-cli</name>
  <description>hopsworks-cli is a library and command-line tool for interacting with the Hopsworks REST API (www.hops.io). You can copy files into Hopsworks, run jobs, etc. </description>
  <url>https://github.com/hopshadoop/hopsworks-cli</url>


  <scm>
    <connection>scm:git:git@github.com:hopshadoop/hopsworks-cli.git</connection>
    <developerConnection>scm:git:ssh://github.com:hopshadoop/hopsworks-cli.git</developerConnection>
    <url>https://github.com/hopshadoop/hopsworks-cli/tree/master</url>
  </scm>

  <developers>
    <developer>
      <name>Jim Dowling</name>
      <email>jdowling@kth.se</email>
      <organization>KTH University</organization>
    </developer>
    <developer>
      <name>Fabien Kirstein</name>
      <organization>Frauenhofer Berlin</organization>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>GNU General Public License, Version 3.0</name>
      <url>https://www.gnu.org/licenses/gpl-3.0.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>
  
  <properties>
    <slf4j.version>1.7.25</slf4j.version>
    <logback.version>1.2.3</logback.version>
    <hadoop.version>2.8.4</hadoop.version>
  </properties>


  <dependencies>
    <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.json</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>javax.json</groupId>
      <artifactId>javax.json-api</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>${hadoop.version}</version>
    </dependency>    
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.3.2</version>
    </dependency>    
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <version>${logback.version}</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpmime</artifactId>
      <version>4.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.4</version>
    </dependency>
    
    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
      <version>1.72</version>
    </dependency>    
  </dependencies>


  <build>
    <plugins>
      <plugin>
	<groupId>org.sonatype.plugins</groupId>
	<artifactId>nexus-staging-maven-plugin</artifactId>
	<version>1.6.7</version>
	<extensions>true</extensions>
	<configuration>
	  <serverId>ossrh</serverId>
	  <nexusUrl>https://oss.sonatype.org/</nexusUrl>
	  <autoReleaseAfterClose>true</autoReleaseAfterClose>
	</configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.1</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
        </configuration>
      </plugin>      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
            <configuration>
              <keyname>${gpg.keyname}</keyname>
              <passphraseServerId>${gpg.keyname}</passphraseServerId>
            </configuration>
          </execution>
        </executions>
      </plugin>      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-source-plugin</artifactId>
	<executions>
	  <execution>
	    <id>attach-sources</id>
	    <goals>
	      <goal>jar</goal>
	    </goals>
	  </execution>
	</executions>
      </plugin>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<executions>
	  <execution>
	    <id>attach-javadocs</id>
	    <goals>
	      <goal>jar</goal>
	    </goals>
	  </execution>
	</executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached> 
              <shadedClassifierName>shaded</shadedClassifierName> 
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>io.hops.cli.main.ComandLineMain</mainClass>
                </transformer>
              </transformers>
              <filters>
                Required by Windows signing certificate 
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>                        
            </configuration>
          </execution>
        </executions>
      </plugin>
            
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.9</version>
        <executions>
          <execution>
            <id>assemble-Hopsworks</id>
            <phase>package</phase>
            <goals>
              <goal>assemble</goal>
            </goals>                
            <configuration>
              <configurationDirectory>conf</configurationDirectory>
              <copyConfigurationDirectory>true</copyConfigurationDirectory>
              <extraJvmArguments>-Xms128m</extraJvmArguments>
              <platforms>
                <platform>unix</platform>
                <platform>windows</platform>
              </platforms>
              <programs>
                <program>
                  <mainClass>io.hops.cli.main.CommandLineMain</mainClass>
                  <id>hopsworks-cli</id>
                </program>
              </programs>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>libs-windows</id>
            <phase>package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/hopsworks-cli-${project.version}/lib</outputDirectory>
              <resources>
                <resource>
                  <directory>lib/</directory>
                  <filtering>false</filtering>
                </resource>
                <resource>
                  <directory>staging/</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>



    </plugins>
  </build>


  <profiles>
    <profile>
      <id>win</id>
      <activation>
        <property>
          <name>win</name>
        </property>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <version>1.7.16</version>
            <executions>
              <execution>
                <id>l4j-clui</id>
                <phase>package</phase>
                <goals>
                  <goal>launch4j</goal>
                </goals>
                <configuration>
                  <outfile>${project.build.directory}/hopsworks.exe</outfile>
                  <dontWrapJar>false</dontWrapJar>
                  <jar>target/${project.artifactId}-${project.version}-shaded.jar</jar>
                  <classPath>
                    <mainClass>io.hops.cli.main.CommandLineMain</mainClass>
                    <preCp>lib\*.jar</preCp>
                  </classPath>
                  <icon>target/classes/assets/favicon.ico</icon>
                  <errTitle>Hopsworks Error</errTitle>
                  <singleInstance>
                    <mutexName>Hopsworks</mutexName>
                    <windowTitle>Another Instance of Hopsworks is already Running.</windowTitle>
                  </singleInstance>
                  <jre>
                    <minVersion>1.7.0</minVersion>
                    <maxVersion>1.9.0</maxVersion>
                    <initialHeapSize>128</initialHeapSize>
                    <maxHeapSize>1024</maxHeapSize>
                    <runtimeBits>64/32</runtimeBits>
                  </jre>
                  <versionInfo>
                    <fileVersion>0.0.0.1</fileVersion>
                    <txtFileVersion>Hopsworks</txtFileVersion>
                    <fileDescription>Hopsworks - orchestration for Chef Solo</fileDescription>
                    <copyright>Hopsworks</copyright>
                    <productVersion>0.0.0.1</productVersion>
                    <txtProductVersion>Hopsworks</txtProductVersion>
                    <productName>Hopsworks</productName>
                    <companyName>hops.io</companyName>
                    <internalName>Hopsworks CLI</internalName>
                    <originalFilename>hopsworks-cli.exe</originalFilename>
                  </versionInfo>
                  <messages>
                    <startupErr>Hopsworks startup error</startupErr>
                    <jreVersionErr>Hopsworks requires 64-bit java version 7 or higher.</jreVersionErr>
                    <launcherErr>Hopsworks launcher error. Hopsworks requires 64-bit java, version 7 or higher.</launcherErr>
                  </messages>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
                
      </build>
    </profile>
    <profile>
      <id>linux</id>
      <activation>
        <property>
          <name>!win</name>
        </property>
      </activation>
    </profile>       
  </profiles>


</project>
