<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">
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.jond3k</groupId>
    <artifactId>jonstructs</artifactId>
    <version>0.3</version>
    <packaging>jar</packaging>
    <name>jonstructs</name>
    <description>Language constructs for Scala</description>
    <url>https://github.com/jond3k/jonstructs</url>

    <!-- fluff for sonatype -->
    <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>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/jond3k/jonstructs</url>
        <connection>scm:git:https://github.com/jond3k/jonstructs.git</connection>
        <developerConnection>scm:git:git@github.com:jond3k/jonstructs.git</developerConnection>
    </scm>

    <!-- fluff for sonatype -->
    <developers>
        <developer>
            <id>jond3k</id>
        </developer>
    </developers>

    <properties>
        <scalaVersion>2.9.1</scalaVersion>
        <encoding>UTF-8</encoding>
    </properties>
    <dependencies>
        <!-- this is a scala project - pull in the scala language -->
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scalaVersion}</version>
        </dependency>

        <!-- this is a scala project - pull in the scala maven plugin -->
        <dependency>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.0.2</version>
        </dependency>

        <!-- we use apache's httpclient for retrieving stuff -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.2</version>
        </dependency>

        <!-- we use slf4j for logging. live with it -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.6</version>
        </dependency>

        <!-- TESTING -->

        <!-- scalatest is used as a general purpose scala testing framework -->
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scalaVersion}</artifactId>
            <version>2.0.M1</version>
            <scope>test</scope>
        </dependency>

    </dependencies>
    <build>
        <!-- setup source directory defaults -->
        <sourceDirectory>src/main/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>

        <plugins>
            <!-- the maven scala plugin allows compilation of scala source code -->
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>scala-compile-first</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>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>doc-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- disable surefire so we don't produce superfluous test reports -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.7</version>
              <configuration>
                <skipTests>true</skipTests>
              </configuration>
            </plugin>

            <!-- enable scalatest -->
            <!--<plugin>
              <groupId>org.scalatest</groupId>
              <artifactId>maven-scalatest-plugin</artifactId>
              <version>1.0-SNAPSHOT</version>
              <configuration>
                <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                <junitxml>.</junitxml>
                <filereports>WDF TestSuite.txt</filereports>
              </configuration>
              <executions>
                <execution>
                  <id>test</id>
                  <goals>
                    <goal>test</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>-->

            <!-- override some maven compiler settings -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerVersion>1.6</compilerVersion>
                    <optimize>false</optimize>
                </configuration>
            </plugin>

            <!-- attach source code -->
            <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>

            <!-- sign the repo -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <!-- use the sonatype public repo -->
    <pluginRepositories>
        <pluginRepository>
            <id>org.sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </pluginRepository>
    </pluginRepositories>

    <!-- a profile that allows us to skip gpg generation with snapshots -->
    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
