<?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>
  <artifactId>scala-masterpom</artifactId>
  <packaging>pom</packaging>
  <name>scala-masterpom</name>
  <description>master pom for scala projects.</description>
  <parent>
    <groupId>tw.hyl.common</groupId>
    <artifactId>masterpom</artifactId>
    <version>1.0.4</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <properties>
    <version.scala>2.10.3</version.scala>
    <version.scala.lib>2.10</version.scala.lib>
    <version.maven.scala>3.1.5</version.maven.scala>
    <version.maven.scalariform>0.1.2</version.maven.scalariform>
    <version.maven.scalastyle>0.2.0</version.maven.scalastyle>
    <version.scct>0.2-SNAPSHOT</version.scct>
  </properties>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.scalariform</groupId>
          <artifactId>scalariform-maven-plugin</artifactId>
          <version>${version.maven.scalariform}</version>
          <executions>
            <execution>
              <phase>process-sources</phase>
              <goals>
                <goal>format</goal>
              </goals>
              <configuration>
                <alignParameters>true</alignParameters>
                <alignSingleLineCaseStatements>true</alignSingleLineCaseStatements>
                <doubleIndentClassDeclaration>true</doubleIndentClassDeclaration>
                <preserveDanglingCloseParenthesis>true</preserveDanglingCloseParenthesis>
                <indentSpaces>4</indentSpaces>
                <indentPackageBlocks>true</indentPackageBlocks>
                <spacesWithinPatternBinders>true</spacesWithinPatternBinders>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
         <groupId>net.alchim31.maven</groupId>
         <artifactId>scala-maven-plugin</artifactId>
         <version>${version.maven.scala}</version>
         <configuration>
           <scalaVersion>${version.scala}</scalaVersion>
           <args>
             <arg>-encoding</arg>
             <arg>UTF-8</arg>
             <arg>-target:jvm-1.6</arg>
             <arg>-deprecation</arg>
             <arg>-feature</arg>
             <arg>-unchecked</arg>
             <arg>-Ywarn-adapted-args</arg>
           </args>
           <jvmArgs>
             <jvmArg>-Xms256m</jvmArg>
             <jvmArg>-Xmx768m</jvmArg>
           </jvmArgs>
         </configuration>
         <executions>
           <execution>
             <id>scala-compile</id>
             <phase>process-resources</phase>
             <goals>
               <goal>add-source</goal>
               <goal>compile</goal>
             </goals>
           </execution>
           <execution>
             <id>scala-test-compile</id>
             <phase>process-test-resources</phase>
             <goals>
               <goal>testCompile</goal>
             </goals>
           </execution>
         </executions>
       </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.maven.surefire}</version>
        <configuration>
          <includes>
            <include>**/*Test.scala</include>
            <include>**/*Test.java</include>
            <include>**/*Spec.scala</include>
            <include>**/*Spec.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>coverage</id>
      <repositories>
        <repository>
          <id>scct repository</id>
          <url>http://mtkopone.github.com/scct/maven-repo</url>
        </repository>
      </repositories>
      <dependencies>
        <dependency>
          <groupId>reaktor</groupId>
          <artifactId>scct_${version.scala.lib}</artifactId>
          <version>${version.scct}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${version.maven.surefire}</version>
            <configuration>
              <includes>
                <include>**/*Test.scala</include>
                <include>**/*Test.java</include>
                <include>**/*Spec.scala</include>
                <include>**/*Spec.java</include>
              </includes>
              <systemPropertyVariables>
                <scct.project.name>${project.name}</scct.project.name>
                <scct.coverage.file>${project.build.outputDirectory}/coverage.data</scct.coverage.file>
                <scct.report.dir>${project.build.directory}/coverage-report</scct.report.dir>
                <scct.source.dir>${project.build.sourceDirectory}</scct.source.dir>
              </systemPropertyVariables>
            </configuration>
          </plugin>
          <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>scala-compile</id>
                <configuration>
                  <args>
                    <args>-P:scct:projectId:${project.name}</args>
                    <args>-P:scct:basedir:${project.basedir}</args>
                  </args>
                  <compilerPlugins>
                    <compilerPlugin>
                      <groupId>reaktor</groupId>
                      <artifactId>scct_${version.scala.lib}</artifactId>
                      <version>${version.scct}</version>
                    </compilerPlugin>
                  </compilerPlugins>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${version.scala}</version>
    </dependency>
  </dependencies>
  <reporting>
    <plugins>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>${version.maven.scala}</version>
      </plugin>
      <plugin>
        <groupId>reaktor.scct</groupId>
        <artifactId>maven-scct-multiproject-report</artifactId>
        <version>${version.scct}</version>
      </plugin>
    </plugins>
  </reporting>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>typesafe-central</id>
      <name>typesafe-releases</name>
      <url>http://repo.typesafe.com/typesafe/releases</url>
    </repository>
    <repository>
      <snapshots />
      <id>typesafe-snapshots</id>
      <name>typesafe-snapshots</name>
      <url>http://repo.typesafe.com/typesafe/snapshots</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>scct-plugin-repo</id>
      <url>http://mtkopone.github.com/scct/maven-repo</url>
    </pluginRepository>
  </pluginRepositories>
</project>
