<?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">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mainstreethub</groupId>
  <artifactId>parent-pom</artifactId>
  <version>1.3</version>
  <packaging>pom</packaging>
  <name>MainStreetHub parent pom</name>
  <description>The parent pom for all MainStreetHub projects.</description>
  <url>https://github.com/mainstreethub/parent-pom</url>

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

  <developers>
    <developer>
      <name>Brandon Beck</name>
      <email>brandon.beck@mainstreethub.com</email>
      <organization>MainStreetHub</organization>
      <organizationUrl>http://www.mainstreethub.com</organizationUrl>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/mainstreethub/parent-pom</url>
    <connection>scm:git:git@github.com:mainstreethub/parent-pom</connection>
    <developerConnection>scm:git:git@github.com:mainstreethub/parent-pom</developerConnection>
    <tag>v1.3</tag>
  </scm>

  <properties>
    <!-- All code/reports are in UTF-8 -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- The minimum java version, children can override this if necessary. -->
    <java.minimum.version>1.7</java.minimum.version>
  </properties>

  <!-- This configures the publication of jars to the S3 bucket. -->
  <distributionManagement>
    <repository>
      <id>maven-s3-release-repo</id>
      <name>S3 Release Repository</name>
      <url>s3://artifacts.mainstreethub.com/maven/releases</url>
    </repository>
    <snapshotRepository>
      <id>maven-s3-snapshot-repo</id>
      <name>S3 Snapshot Repository</name>
      <url>s3://artifacts.mainstreethub.com/maven/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <!-- This configures the reading of jars from the S3 bucket. -->
  <repositories>
    <repository>
      <id>maven-s3-release-repo</id>
      <name>S3 Release Repository</name>
      <url>s3://artifacts.mainstreethub.com/maven/releases</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>maven-s3-snapshot-repo</id>
      <name>S3 Release Repository</name>
      <url>s3://artifacts.mainstreethub.com/maven/snapshots</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <build>
    <!-- These plugins take effect for all child poms of this one. -->
    <pluginManagement>
      <plugins>
        <!-- Enforce minimum Maven and Java versions. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.3.1</version>
          <executions>
            <execution>
              <id>enforce-versions</id>
              <phase>initialize</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <requireMavenVersion>
                    <version>3.0</version>
                  </requireMavenVersion>
                  <requireJavaVersion>
                    <version>${java.minimum.version}</version>
                  </requireJavaVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <!-- The compiler should always build code using the minimum version. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.2</version>
          <configuration>
            <source>${java.minimum.version}</source>
            <target>${java.minimum.version}</target>
          </configuration>
        </plugin>

        <!-- Release tags should be v<VERSION>. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <tagNameFormat>v@{project.version}</tagNameFormat>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <!-- These plugins take effect only for this pom. -->
    <plugins>
      <!-- Use a recent version of the release plugin to avoid bugs with uploading to S3. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <tagNameFormat>v@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
    </plugins>

    <extensions>
      <!-- Publish everything to S3 instead of a maven repo. -->
      <extension>
        <groupId>com.mainstreethub.build</groupId>
        <artifactId>aws-maven</artifactId>
        <version>5.0.0.RELEASE.MSH.1</version>
      </extension>
    </extensions>
  </build>
</project>
