<?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">
  <!-- Usage: As per the general contract of Maven builds a full build that compiles, 
    runs tests, packages and installs build artifacts (jar files) in the local Maven 
    repository can be executed via: mvn clean install. To generate a project site with 
    various reports use the Maven site plugin: mvn clean install && mvn site && mvn site:stage 
    -DstagingDirectory=<devsite> See the Maven site plugin for more details: http://maven.apache.org/plugins/maven-site-plugin/usage.html -->

  <modelVersion>4.0.0</modelVersion>
  <groupId>com.elastisys.scale</groupId>
  <artifactId>commons.root</artifactId>
  <version>2.2.4</version>
  <name>elastisys:scale :: commons :: root</name>
  <description>Common Java libraries and utilities for elastisys:scale-related software.</description>
  <packaging>pom</packaging>
  <url>http://www.elastisys.com</url>
  <organization>
    <name>elastisys</name>
    <url>http://www.elastisys.com</url>
  </organization>
  <inceptionYear>2011</inceptionYear>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <modules>
    <module>buildtools</module>
    <module>json</module>
    <module>net</module>
    <module>rest</module>
    <module>server</module>
    <module>util</module>
    <module>logreplayer</module>
    <module>security</module>
    <module>openstack</module>
  </modules>

  <!-- Location of Git repository. Used to tag releases. -->
  <scm>
    <developerConnection>scm:git:https://github.com/elastisys/scale.commons.git</developerConnection>
    <tag>2.2.4</tag>
    <url>https://github.com/elastisys/scale.commons</url>
  </scm>

  <properties>
    <!-- Instructs text processing plugins in inheriting projects to use UTF-8 source 
      file encoding. -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- Required JDK version -->
    <java.version>1.8</java.version>

    <!-- Version bump made on 2014-12-18 -->
    <guava.version>18.0</guava.version>
    <guice.version>4.1.0</guice.version>
    <apache.httpclient.version>4.5.1</apache.httpclient.version>
    <jetty.version>9.3.5.v20151012</jetty.version>
    <jaxrs.version>2.0.1</jaxrs.version>
    <servlet.api.version>3.1.0</servlet.api.version>
    <jersey.version>2.22.1</jersey.version>
    <commons.mail.version>1.4</commons.mail.version>
    <gson.version>2.3.1</gson.version>
    <slf4j.version>1.7.7</slf4j.version>
    <logback.version>1.1.2</logback.version>
    <joda.time.version>2.6</joda.time.version>
    <quarts.version>2.2.1</quarts.version>
    <commons.math.version>3.3</commons.math.version>
    <jsch.version>0.1.51</jsch.version>
    <args4j.version>2.32</args4j.version>
    <jose4j.version>0.4.4</jose4j.version>
    <bouncycastle.version>1.53</bouncycastle.version>
    <openstack4j.version>3.0.2</openstack4j.version>

    <!-- test dependencies -->
    <junit.version>4.12</junit.version>
    <mockito.version>1.10.19</mockito.version>
    <greenmail.version>1.4.1</greenmail.version>

  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>${guava.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>${guice.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-multibindings</artifactId>
        <version>${guice.version}</version>
      </dependency>      
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>${joda.time.version}</version>
      </dependency>
      <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>${quarts.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>${apache.httpclient.version}</version>
      </dependency>
      <!-- Java mail support -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
        <version>${commons.mail.version}</version>
      </dependency>
      <!-- Mathematics/statistics library -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-math3</artifactId>
        <version>${commons.math.version}</version>
      </dependency>
      <!-- logging -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <!-- Jakarta (Apache) Commons Logging bridge to SLF4J. -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</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>

      <!-- JSON parsing -->
      <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>${gson.version}</version>
      </dependency>

      <!-- Needed for ssh access to nodes -->
      <dependency>
        <groupId>com.jcraft</groupId>
        <artifactId>jsch</artifactId>
        <version>${jsch.version}</version>
      </dependency>

      <!-- JAX-RS API -->
      <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>javax.ws.rs-api</artifactId>
        <version>${jaxrs.version}</version>
      </dependency>
      <!-- Jersey and JAX-RS API -->
      <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>${jersey.version}</version>
      </dependency>
      <!-- Jersey REST client -->
      <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>${jersey.version}</version>
      </dependency>

      <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>${servlet.api.version}</version>
      </dependency>

      <!-- Embeddable Jetty HTTP server -->
      <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlet</artifactId>
        <version>${jetty.version}</version>
      </dependency>
      <!-- Utility servlets and filters -->
      <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-servlets</artifactId>
        <version>${jetty.version}</version>
      </dependency>
      <!-- URL rewrite handlers -->
      <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-rewrite</artifactId>
        <version>${jetty.version}</version>
      </dependency>


      <!-- command-line parsing -->
      <dependency>
        <groupId>args4j</groupId>
        <artifactId>args4j</artifactId>
        <version>${args4j.version}</version>
      </dependency>

      <!-- Library for manipulating JSON Web Tokens (JWTs) -->
      <dependency>
        <groupId>org.bitbucket.b_c</groupId>
        <artifactId>jose4j</artifactId>
        <version>${jose4j.version}</version>
      </dependency>

      <!-- Cryptographic tool libraries -->
      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk15on</artifactId>
        <version>${bouncycastle.version}</version>
      </dependency>
      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk15on</artifactId>
        <version>${bouncycastle.version}</version>
      </dependency>

      <!-- OpenStack API access -->
      <dependency>
        <groupId>org.pacesys</groupId>
        <artifactId>openstack4j-core</artifactId>
        <version>${openstack4j.version}</version>
      </dependency>
      <!-- openstack4j connector -->
      <dependency>
        <groupId>org.pacesys.openstack4j.connectors</groupId>
        <artifactId>openstack4j-jersey2</artifactId>
        <version>${openstack4j.version}</version>
      </dependency>
      
      <!-- Test dependencies -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.icegreen</groupId>
        <artifactId>greenmail</artifactId>
        <version>${greenmail.version}</version>
        <scope>test</scope>
      </dependency>

    </dependencies>
  </dependencyManagement>


  <build>
    <plugins>

      <!-- Unit tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.16</version>
        <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
          <!-- Needed to make Cobertura work with Java7 -->
          <!-- (see http://stackoverflow.com/questions/7010665/testng-emma-cobertura-coverage-and-jdk-7-result-in-classformaterror-and-verif) -->
          <argLine>-XX:-UseSplitVerifier</argLine>
        </configuration>
      </plugin>

      <!-- Compile byte code compatible with the targeted Java version -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>

      <!-- Enforce Java version -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.3</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[${java.version},)</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- UTF-8 encoding of resource files -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.10</version>
        <dependencies>
          <!-- make sure project-specific checkstyle rules are picked up -->
          <dependency>
            <groupId>com.elastisys.scale</groupId>
            <artifactId>commons.buildtools</artifactId>
            <version>${project.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>checkstyle/checkstyle-rules.xml</configLocation>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.3</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <!-- Git tag should only be project version, e.g. "1.0.1" -->
          <tagNameFormat>@{project.version}</tagNameFormat>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>

      <!-- Configure maven-jar-plugin. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
      </plugin>

      <!-- Configure maven-war-plugin. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <!-- Deploys a jar artifact with classifier 'classes' alongside war artifact. 
            Can be referenced as a dependency by other projects. -->
          <attachClasses>true</attachClasses>
          <classesClassifier>classes</classesClassifier>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <reporting>
    <plugins>
      <!-- generates various reports for the project site -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.7</version>
        <configuration>
        </configuration>
        <reportSets>
          <reportSet>
            <!-- the reports to generate -->
            <reports>
              <report>index</report>
              <report>project-team</report>
              <report>dependency-management</report>
              <report>dependency-info</report>
              <report>issue-tracking</report>
              <report>modules</report>
              <report>summary</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <!-- javadoc generation plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9.1</version>
        <configuration>
          <quiet>true</quiet>
          <source>1.7</source>
          <links>
            <link>http://docs.oracle.com/javase/7/docs/api/</link>
          </links>
        </configuration>
      </plugin>
      <!-- Java cross-reference plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>2.3</version>
      </plugin>
      <!-- test result report generation -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.16</version>
        <configuration>
          <aggregate>true</aggregate>
        </configuration>
      </plugin>
      <!-- reports test coverage of unit tests -->
      <!-- Note: cobertura doesn't work with Java7, unless -XX:-UseSplitVerifier
        is given as JVM argument to surefire test plugin -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.5.2</version>
        <configuration>
          <!-- unfortuantely, aggregate reports don't seem to work <aggregate>true</aggregate> -->
          <formats>
            <format>xml</format>
            <format>html</format>
          </formats>
        </configuration>
      </plugin>
      <!-- -->
      <!-- warns when project style conventions are violated -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.10</version>
        <configuration>
          <!-- make sure project-specific checkstyle rules are picked up from
            the buildtools module -->
          <configLocation>checkstyle/checkstyle-rules.xml</configLocation>
        </configuration>
      </plugin>
      <!-- reports on suspected bug patterns -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.5.2</version>
      </plugin>
      <!-- PMD source code analyzer -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.0.1</version>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <!-- Plugins that are only included in release builds -->
        <plugins>
          <!-- Attach sources to published Maven artifacts -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Attach javadocs to published Maven artifacts -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Sign published Maven artifacts -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <issueManagement>
    <system>GitHub Issue Management</system>
    <url>https://github.com/elastisys/scale.commons/issues</url>
  </issueManagement>

  <developers>
    <developer>
      <id>peterg</id>
      <name>Peter Gardfjäll</name>
      <email>peter.gardfjall@elastisys.com</email>
      <url>http://elastisys.com/</url>
      <organization>Elastisys AB</organization>
      <organizationUrl>http://elastisys.com/</organizationUrl>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
    <developer>
      <id>larsson</id>
      <name>Lars Larsson</name>
      <email>lars.larsson@elastisys.com</email>
      <url>http://elastisys.com/</url>
      <organization>Elastisys AB</organization>
      <organizationUrl>http://elastisys.com/</organizationUrl>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
  </developers>


  <!-- Destination repositories for releases (Sonatype's OSS Repository Hosting). 
    Note: for releases to succeed, proper server credentials for the repository server 
    need to be added to the ~/.m2/settings.xml file of the user performing the release. 
    The ~/.m2/settings.xml file also needs to contain GPG signing credenials. For more 
    details, see http://central.sonatype.org/pages/apache-maven.html. -->
  <distributionManagement>
    <!-- release repo -->
    <repository>
      <id>oss-repo</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <!-- snapshot repo -->
    <snapshotRepository>
      <id>oss-repo</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <!-- The URL to which the project site is deployed when running mvn site:deploy. 
      See http://maven.apache.org/plugins/maven-site-plugin/usage.html -->
    <site>
      <id>development.site</id>
      <url>file:///scratch/devsite/scale.commons</url>
    </site>
  </distributionManagement>


</project>
