<?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>
  <groupId>tw.hyl.common</groupId>
  <artifactId>masterpom</artifactId>
  <version>1.1.2</version>
  <packaging>pom</packaging>
  <name>masterpom</name>
  <description>Common dependency versions and settings.</description>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <prerequisites>
    <maven>3.0.5</maven>
  </prerequisites>
  <modules>
    <module>buildtools</module>
    <module>scala-masterpom</module>
  </modules>
  <scm>
    <developerConnection>scm:git:git@github.com:yunglin/common-masterpom.git</developerConnection>
    <url>http://github.com/yunglin/common-masterpom</url>
    <tag>masterpom-1.1.2</tag>
  </scm>
  <developers>
    <developer>
      <id>hyl</id>
      <email>yunglin@yunglinho.com</email>
      <roles>
        <role>developer</role>
      </roles>
      <properties>
        <picUrl>http://www.gravatar.com/avatar/2e147e13e3cf585a86626062d710a205</picUrl>
      </properties>
    </developer>
  </developers>
  <properties>
    <version.maven.changes>2.8</version.maven.changes>
    <version.maven.compiler>2.5.1</version.maven.compiler>
    <version.maven.cobertura>2.5.1</version.maven.cobertura>
    <version.maven.enforcer>1.3</version.maven.enforcer>
    <version.maven.findbugs>2.5.2</version.maven.findbugs>
    <version.maven.javadoc>2.9</version.maven.javadoc>
    <version.maven.release>2.5.1</version.maven.release>
    <version.maven.resources>2.6</version.maven.resources>
    <version.maven.report>2.7</version.maven.report>
    <version.maven.site>3.3</version.maven.site>
    <version.maven.source>2.2</version.maven.source>
    <version.maven.surefire>2.17</version.maven.surefire>
    <version.maven.wagon.ssh>2.4</version.maven.wagon.ssh>
    <version.slf4j>1.7.2</version.slf4j>
    <version.logback>1.0.9</version.logback>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <buildNumber>dev</buildNumber>
  </properties>

  <build>

    <!-- added build number to the file name of package generated.-->
    <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>

    <plugins>
      <!-- force maven to build in java 1.6 format..-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${version.maven.compiler}</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- enforce build environment. If you run maven other than ver 3.0.4 or jdk 1.6.0_35,
         maven won't run and it will throw an error message.
      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${version.maven.enforcer}</version>
        <executions>
          <execution>
            <id>enforce-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <rules>
            <requireMavenVersion>
              <version>3.0.5</version>
            </requireMavenVersion>
            <requireJavaVersion>
              <version>[1.6.0-35,)</version>
            </requireJavaVersion>
          </rules>
        </configuration>
      </plugin>

      <!-- force maven to treat source code and resource file as UTF-8 format. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${version.maven.resources}</version>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!-- force maven to add build number to META-INF/MANIFEST in the war file(if any). -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
              <manifestEntries>
                <Implementation-Build>${buildNumber}</Implementation-Build>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <!-- force maven to add build number to META-INF/MANIFEST in the jar file(if any). -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
              <manifestEntries>
                <Implementation-Build>${buildNumber}</Implementation-Build>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <!-- generate findbugs report -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>${version.maven.findbugs}</version>
        </plugin>
        <!-- generate test coverage report -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>cobertura-maven-plugin</artifactId>
          <version>${version.maven.cobertura}</version>
          <configuration>
            <formats>
              <format>xml</format>
              <format>html</format>
            </formats>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>clean</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <!-- force maven to use the latest release plugin due to the change in the git-scm url format -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${version.maven.release}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-report-plugin</artifactId>
          <version>${version.maven.surefire}</version>
        </plugin>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${version.maven.site}</version>
          <dependencies>
            <dependency><!-- add support for ssh/scp -->
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-ssh</artifactId>
              <version>${version.maven.wagon.ssh}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>${version.maven.report}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>${version.maven.surefire}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>${version.maven.changes}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>changes-report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${version.maven.cobertura}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>${version.maven.findbugs}</version>
      </plugin>
      <!-- force maven to generate javadoc site. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${version.maven.javadoc}</version>
      </plugin>
    </plugins>
  </reporting>
  <repositories>
    <repository>
      <id>typesafe</id>
      <name>typesafe repo</name>
      <url>http://repo.typesafe.com/typesafe/releases/</url>
    </repository>
  </repositories>
  <distributionManagement>
  </distributionManagement>

  <profiles>
    <profile>
      <id>bamboo</id>
      <!-- force maven to generate source jar. -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${version.maven.source}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- force maven to generate javadoc jar. -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${version.maven.javadoc}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
