<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>com.getperka</groupId>
  <artifactId>perka-oss-parent</artifactId>
  <version>1.3</version>
  <packaging>pom</packaging>
  <name>Perka Open Source Parent</name>
  <description>Common settings for Perka open-source projects</description>
  <url>https://github.com/perka/oss-parent</url>
  <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>
  <scm>
    <url>https://github.com/perka/oss-parent</url>
    <connection>scm:git:git@github.com:perka/oss-parent.git</connection>
    <developerConnection>scm:git:git@github.com:perka/oss-parent.git</developerConnection>
    <tag>perka-oss-parent-1.3</tag>
  </scm>
  <developers>
    <developer>
      <email>bob@getperka.com</email>
      <name>Bob Vawter</name>
    </developer>
    <developer>
      <email>joe@getperka.com</email>
      <name>Joe Stelmach</name>
    </developer>
  </developers>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <build>
    <plugins>
      <!-- Disallow use of transitive dependencies without declaring them. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <ignoreNonCompile>true</ignoreNonCompile>
          <failOnWarning>true</failOnWarning>
          <outputXML>true</outputXML>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <phase>test</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <!-- compiler plugin -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <compilerArgument>-proc:none</compilerArgument>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
        </plugin>

        <!-- release plugin -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.3.2</version><!--$NO-MVN-MAN-VER$ -->
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <arguments>-Psonatype-oss-release -Pperka-release</arguments>
          </configuration>
        </plugin>

        <!-- Set deploy plugin version -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.7</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <!-- Activated by the release-plugin configuration -->
      <id>perka-release</id>
      <build>
        <plugins>
          <!-- Keep our licensing story straight -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <version>1.2</version>
            <configuration>
              <inceptionYear>2012</inceptionYear>
              <licenseName>apache_v2</licenseName>
              <licenseFile>${project.groupId}.${project.artifactId}-LICENSE.txt</licenseFile>
              <organizationName>Perka Inc.</organizationName>
              <roots>
                <root>src/main</root>
                <root>src/test</root>
              </roots>
            </configuration>
            <executions>
              <execution>
                <id>first</id>
                <goals>
                  <goal>update-project-license</goal>
                </goals>
              </execution>
              <execution>
                <id>second</id>
                <goals>
                  <goal>update-file-header</goal>
                </goals>
                <phase>process-sources</phase>
                <configuration>
                  <extraExtensions>
                    <stg>java</stg>
                  </extraExtensions>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- Define presets to produce a packed roll-up binary. To enable this 
      profile, create an .isShaded file at the root of the project. -->
    <profile>
      <id>perka-shaded</id>
      <activation>
        <file>
          <exists>${basedir}/.isShaded</exists>
        </file>
      </activation>

      <properties>
        <com.getperka.perka-oss-parent.mainClass />
      </properties>

      <build>
        <plugins>
          <!-- Create a single jar with all dependencies -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.7</version>
            <!-- Bind to the package phase -->
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <!-- Dependent projects won't pull in the huge jar -->
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <filters>
                <!-- Delete all signed resource manifests -->
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/*.SF</exclude>
                  </excludes>
                </filter>
              </filters>
              <!-- Merge service files -->
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>${com.getperka.perka-oss-parent.mainClass}</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
