<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2011 Ness Computing, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<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>

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

  <groupId>com.nesscomputing</groupId>
  <artifactId>ness-oss-parent</artifactId>
  <packaging>pom</packaging>
  <version>34</version>
  <name>ness-oss-parent</name>
  <description>This is the parent POM for Ness open source maven projects.</description>
  <url>https://opensource.nesscomputing.com/</url>

  <licenses>
    <license>
      <name>Apache 2</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>
    <connection>scm:git:git://github.com/NessComputing/ness-oss-parent.git</connection>
    <developerConnection>scm:git:git@github.com:NessComputing/ness-oss-parent.git</developerConnection>
    <url>http://github.com/NessComputing/ness-oss-parent</url>
    <tag>ness-oss-parent-34</tag>
  </scm>

  <organization>
    <name>Ness Computing, Inc.</name>
    <url>http://www.nesscomputing.com/</url>
  </organization>

  <developers>
    <developer>
      <id>ness</id>
      <name>Ness Computing Open Source Team</name>
      <email>opensource@nesscomputing.com</email>
      <url>http://opensource.nesscomputing.com/</url>
      <timezone>-8</timezone>
    </developer>
  </developers>

  <properties>
    <!-- see http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.targetJdk>1.7</project.build.targetJdk>
    <ness.build.jvmsize>1024m</ness.build.jvmsize>

    <!-- the current "best" version of maven -->
    <ness.maven.version>3.0.4</ness.maven.version>
    <!-- In Multimodule builds, override this to point at the parent directory for e.g. the license resources. -->
    <!-- See http://stackoverflow.com/questions/6061537/usage-of-maven-basedir-in-multi-module-setup -->
    <ness.root.dir>${project.basedir}</ness.root.dir>

    <!-- -Dness.skip.check-build=true on the command line turns off the various build checkers. -->
    <ness.skip.check-build>false</ness.skip.check-build>

    <ness.dep.guice.version>3.0</ness.dep.guice.version>
    <ness.dep.slf4j.version>1.7.5</ness.dep.slf4j.version>
    <argLine />
  </properties>

  <prerequisites>
    <maven>${ness.maven.version}</maven>
  </prerequisites>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
      </resource>
      <resource>
        <directory>${basedir}/src/main/java</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
      <resource>
        <directory>${basedir}/target/generated-resources</directory>
      </resource>
    </resources>

    <pluginManagement>
      <plugins>

        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
        <!-- The plugin versions in here are pure "range", don't bother syncing them to the actual plugins. -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>enforce</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.ning.maven.plugins
                    </groupId>
                    <artifactId>maven-dependency-versions-check-plugin
                    </artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>check</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.nesscomputing.mojo</groupId>
                    <artifactId>numbers-maven-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>get</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>pl.project13.maven</groupId>
                    <artifactId>git-commit-id-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>revision</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>analyze-dep-mgt</goal>
                      <goal>analyze-duplicate</goal>
                      <goal>analyze-only</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.ning.maven.plugins</groupId>
                    <artifactId>maven-duplicate-finder-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>check</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <version>1.7</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.7</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.5</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.3.1</version>
        </plugin>

        <!--
            MAVEN-ENFORCER-PLUGIN (The Loving Iron Fist of Maven (TM))
            These artifacts are considered hazardous to your health.
            Each has its own rationale, described below inline.
        -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.3.1</version>
          <executions>
            <execution>
              <id>default</id>
              <phase>validate</phase>
              <goals>
                <goal>enforce</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skip>${ness.skip.check-build}</skip>
            <rules>
              <bannedDependencies>
                <!-- Now here is an arcane trick. See http://www.sonatype.com/people/2007/06/how-to-merge-sub-items-from-parent-pom-to-child-pom-in-a-maven-plugin-configuration-2/ for details... -->
                <excludes combine.children="append">
                  <!-- clashes with commons-logging:commons-logging -->
                  <exclude>commons-logging:commons-logging-api</exclude>
                  <!-- clashes with cglib:cglib-nodep -->
                  <exclude>cglib:cglib</exclude>
                  <!-- commons-logging directs to log4j directly.  No need for slf4j -->
                  <exclude>org.slf4j:jcl-over-slf4j</exclude>
                  <!-- junit-dep used to have a classless repackaging of Hamcrest, but now is deprecated. -->
                  <exclude>junit:junit-dep</exclude>
                  <!-- completely and utterly broken -->
                  <exclude>org.weakref:jmxutils:(,1.11]</exclude>
                  <!-- only the jsr305 jar is allowed, for @SuppressWarnings use our own custom jar -->
                  <exclude>com.google.code.findbugs:annotations</exclude>
                  <!-- nothing from the old trumpet namespace -->
                  <exclude>io.trumpet.components:*</exclude>
                  <!-- nor can we let out any of our internal things -->
                  <exclude>ness.components:*</exclude>
                  <!-- moved on to com.nesscomputing.* -->
                  <exclude>com.likeness.components:*</exclude>
                  <exclude>com.nesscomputing.components:ness-core:(,1.6.0)</exclude>
                  <exclude>com.nesscomputing.components:ness-jersey:(,1.8.0)</exclude>
                  <!-- stop using the httpserver based standalone service, move towards ness-server and ness-server-templates. -->
                  <!-- the following excludes ensure that it is no longer possible to build a service in any other way than using ness-server -->
                  <exclude>com.nesscomputing.components:ness-jersey-server</exclude>
                  <exclude>com.nesscomputing.components:ness-httpserver:(,2.3.0)</exclude>
                  <exclude>com.nesscomputing.components:ness-integration-testing:(,3.3.0)</exclude>
                  <exclude>com.nesscomputing.components:ness-server:(,2.2.1)</exclude>
                  <exclude>com.nesscomputing.components:ness-server-templates:(,2.2.1)</exclude>
                  <exclude>com.nesscomputing.components:ness-logging:(,1.1.1)</exclude>
                  <exclude>com.nesscomputing.components:ness-jackson:(,2.2.2)</exclude>
                  <exclude>com.nesscomputing.components:ness-httpclient:(,2.0.2)</exclude>
                  <exclude>com.nesscomputing.components:ness-jmx:(,1.3.1)</exclude> <!-- broken with jmxutils 1.14 -->
                </excludes>
              </bannedDependencies>
              <requireMavenVersion>
                <version>${ness.maven.version}</version>
              </requireMavenVersion>
              <requireJavaVersion>
                <version>${project.build.targetJdk}</version>
              </requireJavaVersion>
              <requireFilesDontExist>
                <files>
                  <file>${basedir}/src/test/resources/log4j.xml</file>
                </files>
              </requireFilesDontExist>
            </rules>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
          <configuration>
            <skip>${ness.skip.check-build}</skip>
            <failOnWarning>true</failOnWarning>
            <ignoreNonCompile>true</ignoreNonCompile>
          </configuration>
          <executions>
            <execution>
              <id>default</id>
              <phase>verify</phase>
              <goals>
                <goal>analyze-only</goal>
                <goal>analyze-duplicate</goal>
                <goal>analyze-dep-mgt</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- Tweak the compiler to use more memory and use UTF-8 for the source code. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <source>${project.build.targetJdk}</source>
            <target>${project.build.targetJdk}</target>
            <encoding>${project.build.sourceEncoding}</encoding>
            <maxmem>${ness.build.jvmsize}</maxmem>
            <showWarnings>true</showWarnings>
            <compilerArguments combine.children="append">
              <Werror />
            </compilerArguments>
          </configuration>
        </plugin>

        <!-- Resource plugins should always use UTF-8 -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.6</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>

        <!-- Make sure that we use the latest version of the assembly plugin. Also always use GNU tar mode. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.4</version>
          <configuration>
            <!-- must be true for our jar-with-dependencies builds -->
            <appendAssemblyId>true</appendAssemblyId>
            <tarLongFileMode>gnu</tarLongFileMode>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.16</version>
          <configuration>
            <useManifestOnlyJar>false</useManifestOnlyJar>
            <argLine>${argLine} -Dfile.encoding=${project.build.sourceEncoding}</argLine>
            <systemPropertyVariables combine.children="append">
              <sun.jnu.encoding>${project.build.sourceEncoding}</sun.jnu.encoding>
              <user.timezone>UTC</user.timezone>
              <java.awt.headless>true</java.awt.headless>
              <ness.log.assimilate>true</ness.log.assimilate>
            </systemPropertyVariables>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.4.2</version>
          <configuration>
            <releaseProfiles>build-javadoc,check-license-headers,sign-release</releaseProfiles>
            <autoVersionSubmodules>true</autoVersionSubmodules>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.9.1</version>
          <configuration>
            <source>${project.build.targetJdk}</source>
            <target>${project.build.targetJdk}</target>
            <encoding>${project.build.sourceEncoding}</encoding>
            <maxmemory>${ness.build.jvmsize}</maxmemory>
          </configuration>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <phase>verify</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- Always build a jar with the test classes -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.4</version>
          <executions>
            <execution>
              <id>attach-tests</id>
              <phase>package</phase>
              <goals>
                <goal>test-jar</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skipIfEmpty>true</skipIfEmpty>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addClasspath>false</addClasspath>
              </manifest>
            </archive>
          </configuration>
        </plugin>

        <!-- bundle up source code into jars for both the main and the test sources -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.2.1</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>package</phase>
              <goals>
                <goal>jar-no-fork</goal>
                <goal>test-jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>com.ning.maven.plugins</groupId>
          <artifactId>maven-duplicate-finder-plugin</artifactId>
          <version>1.0.4</version>
          <executions>
            <execution>
              <id>default</id>
              <phase>validate</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <skip>${ness.skip.check-build}</skip>
            <failBuildInCaseOfConflict>true</failBuildInCaseOfConflict>
            <exceptions combine.children="append">
              <exception>
                <conflictingDependencies>
                  <dependency>
                    <groupId>commons-beanutils</groupId>
                    <artifactId>commons-beanutils</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>commons-beanutils</groupId>
                    <artifactId>commons-beanutils-core</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>commons-collections</groupId>
                    <artifactId>commons-collections</artifactId>
                  </dependency>
                </conflictingDependencies>
                <classes>
                  <class>org.apache.commons.collections.ArrayStack</class>
                  <class>org.apache.commons.collections.Buffer</class>
                  <class>org.apache.commons.collections.BufferUnderflowException</class>
                  <class>org.apache.commons.collections.FastHashMap</class>
                </classes>
              </exception>
              <exception>
                <conflictingDependencies>
                  <dependency>
                    <groupId>commons-beanutils</groupId>
                    <artifactId>commons-beanutils</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>commons-beanutils</groupId>
                    <artifactId>commons-beanutils-core</artifactId>
                  </dependency>
                </conflictingDependencies>
                <packages>
                  <package>org.apache.commons.beanutils</package>
                </packages>
              </exception>
              <exception>
                <conflictingDependencies>
                  <dependency>
                    <groupId>org.apache.activemq</groupId>
                    <artifactId>activemq-core</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>org.apache.activemq.protobuf</groupId>
                    <artifactId>activemq-protobuf</artifactId>
                  </dependency>
                </conflictingDependencies>
                <packages>
                  <package>org.apache.activemq.protobuf</package>
                </packages>
              </exception>
              <exception>
                <conflictingDependencies>
                  <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-core</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-client</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-server</artifactId>
                  </dependency>
                </conflictingDependencies>
                <resources>
                  <resource>META-INF/jersey-module-version</resource>
                </resources>
              </exception>
            </exceptions>
            <ignoredResources combine.children="append">
              <!-- to be found in the jetty jars -->
              <ignoredResource>about\.html</ignoredResource>
              <!-- jersey-core, jersey-server -->
              <ignoredResource>META-INF/jersey-module-version</ignoredResource>
              <ignoredResource>META-INF/README\.txt</ignoredResource>
              <ignoredResource>META-INF/RELEASE-NOTES\.txt</ignoredResource>
              <ignoredResource>META-INF/eclipse\.inf</ignoredResource>
              <ignoredResource>META-INF/ECLIPSEF\.RSA</ignoredResource>
              <ignoredResource>META-INF/ECLIPSEF\.SF</ignoredResource>
              <ignoredResource>about_files/LICENSE_ASL20\.txt</ignoredResource>
              <ignoredResource>about_files/LICENSE_CDDL\.txt</ignoredResource>
              <ignoredResource>plugin\.properties</ignoredResource>
            </ignoredResources>
          </configuration>
        </plugin>

        <plugin>
          <groupId>com.ning.maven.plugins</groupId>
          <artifactId>maven-dependency-versions-check-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
            <skip>${ness.skip.check-build}</skip>
            <failBuildInCaseOfConflict>true</failBuildInCaseOfConflict>
            <failOnWarning>true</failOnWarning>
          </configuration>
          <executions>
            <execution>
              <id>default</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <skip>${ness.skip.check-build}</skip>
            <jvmargs>-Xmx${ness.build.jvmsize}</jvmargs>
            <failOnError>true</failOnError>
          </configuration>
          <executions>
            <execution>
              <id>default</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>3.0.1</version>
          <configuration>
            <skip>${ness.skip.check-build}</skip>
            <targetJdk>${project.build.targetJdk}</targetJdk>
            <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
            <minimumTokens>100</minimumTokens>
            <excludes>
              <exclude>**/*Bean.java</exclude>
              <exclude>**/generated/*.java</exclude>
            </excludes>
            <excludeRoots>
              <excludeRoot>target/generated-sources/stubs</excludeRoot>
            </excludeRoots>
            <rulesets>
              <ruleset>/rulesets/java/basic.xml</ruleset>
              <ruleset>/rulesets/java/clone.xml</ruleset>
              <ruleset>/rulesets/java/finalizers.xml</ruleset>
              <ruleset>/rulesets/java/imports.xml</ruleset>
              <ruleset>/rulesets/java/junit.xml</ruleset>
              <ruleset>/rulesets/java/logging-java.xml</ruleset>
            </rulesets>
          </configuration>
          <executions>
            <execution>
              <id>default</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>2.1</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>com.mycila.maven-license-plugin</groupId>
          <artifactId>maven-license-plugin</artifactId>
          <version>1.9.0</version>
          <inherited>true</inherited>
          <configuration>
            <header>${ness.root.dir}/src/ness/LICENSE-HEADER.txt</header>
            <aggregate>true</aggregate>
            <failIfMissing>true</failIfMissing>
            <encoding>${project.build.sourceEncoding}</encoding>
            <excludes>
              <exclude>.hg*</exclude>
              <exclude>.git*</exclude>
              <exclude>**/*.md</exclude>
              <exclude>**/*.sh</exclude>
              <exclude>**/*.txt</exclude>
              <exclude>**/*.releaseBackup</exclude>
              <exclude>**/*.vm</exclude>
            </excludes>
            <includes>
              <include>src/**</include>
              <include>pom.xml</include>
            </includes>
            <strictCheck>true</strictCheck>
          </configuration>
          <executions>
            <execution>
              <id>default</id>
              <phase>verify</phase>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.4</version>
          <configuration>
            <useAgent>true</useAgent>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.3</version>
        </plugin>

        <plugin>
          <groupId>pl.project13.maven</groupId>
          <artifactId>git-commit-id-plugin</artifactId>
          <version>2.1.5</version>
          <executions>
            <execution>
              <goals>
                <goal>revision</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <generateGitPropertiesFile>true</generateGitPropertiesFile>
            <generateGitPropertiesFilename>target/generated-resources/git_${project.groupId}_${project.artifactId}.properties</generateGitPropertiesFilename>
            <failOnNoGitDirectory>false</failOnNoGitDirectory>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>com.ning.maven.plugins</groupId>
        <artifactId>maven-dependency-versions-check-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>com.ning.maven.plugins</groupId>
        <artifactId>maven-duplicate-finder-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
      </plugin>
      
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <!-- Contains a number of "global" dependencies that should never change across our code base. -->
  <dependencies>
    <dependency>
      <groupId>com.nesscomputing.testing</groupId>
      <artifactId>ness-log4j-config</artifactId>
      <version>1.0.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  
  <dependencyManagement>
    <dependencies>
      <!-- Google Guice -->
      <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>${ness.dep.guice.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-servlet</artifactId>
        <version>${ness.dep.guice.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-assistedinject</artifactId>
        <version>${ness.dep.guice.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-multibindings</artifactId>
        <version>${ness.dep.guice.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.inject.extensions</groupId>
        <artifactId>guice-throwingproviders</artifactId>
        <version>${ness.dep.guice.version}</version>
      </dependency>

      <!-- Guava -->
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>15.0</version>
      </dependency>

      <!-- Joda -->
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.3</version>
      </dependency>

      <!-- config-magic -->
      <dependency>
        <groupId>org.skife.config</groupId>
        <artifactId>config-magic</artifactId>
        <version>0.17</version>
      </dependency>

      <dependency>
        <groupId>org.weakref</groupId>
        <artifactId>jmxutils</artifactId>
        <version>1.14</version>
      </dependency>

      <!-- Logging -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${ness.dep.slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>${ness.dep.slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${ness.dep.slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
      </dependency>
      <dependency>
        <groupId>com.nesscomputing</groupId>
        <artifactId>ness-syslog4j</artifactId>
        <version>0.9.47-NESS-8</version>
      </dependency>

      <!-- Apache commons components -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
      </dependency>
      <dependency>
        <groupId>commons-configuration</groupId>
        <artifactId>commons-configuration</artifactId>
        <version>1.10</version>
      </dependency>
      <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.8</version>
      </dependency>
      <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.1</version>
      </dependency>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
      </dependency>
      <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.8.3</version>
      </dependency>

      <!-- findbugs -->
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>jsr305</artifactId>
        <version>2.0.2</version>
      </dependency>

      <!-- Java APIs -->
      <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
      </dependency>

      <!-- Testing -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
      </dependency>
      <dependency>
        <groupId>org.easymock</groupId>
        <artifactId>easymock</artifactId>
        <version>3.2</version>
      </dependency>
      <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-core</artifactId>
        <version>1.3</version>
      </dependency>
      <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <version>1.3</version>
      </dependency>
      <dependency>
        <groupId>org.objenesis</groupId>
        <artifactId>objenesis</artifactId>
        <version>2.1</version>
      </dependency>
      <dependency>
        <groupId>com.nesscomputing.testing</groupId>
        <artifactId>kawala-lessio</artifactId>
        <version>2.2.0</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <profiles>
    <profile>
      <id>build-javadoc</id>
      <activation>
        <property>
          <name>build-javadoc</name>
        </property>
      </activation>
      <build>
        <plugins>
          <!-- oss requires a javadoc jar. Build one when releasing. -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>check-license-headers</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <property>
          <name>check-license-headers</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.mycila.maven-license-plugin</groupId>
            <artifactId>maven-license-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>sign-release</id>
      <activation>
        <property>
          <name>sign-release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <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>
    </profile>

    <!-- The lessio project itself uses this as a base, so we must make the lessio dependency optional.
         A project with a magic ".no-lessio" file will skip the LessIoSecurityManager -->

    <profile>
      <id>lessio-dependency</id>
      <activation>
        <file>
          <missing>.no-lessio</missing>
        </file>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.nesscomputing.testing</groupId>
          <artifactId>kawala-lessio</artifactId>
          <scope>test</scope>
          <optional>true</optional>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <configuration>
                <argLine>${argLine} -Dfile.encoding=${project.build.sourceEncoding} -Djava.security.manager=com.nesscomputing.testing.lessio.LessIOSecurityManager</argLine>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <!-- ======================================================================== -->
    <!-- =                                                                      = -->
    <!-- = Galaxy profile. Builds a tarball from a web application that is a    = -->
    <!-- = deployable unit.                                                     = -->
    <!-- =                                                                      = -->
    <!-- ======================================================================== -->

    <profile>
      <id>build-galaxy</id>
      <activation>
        <file>
          <exists>.build-galaxy</exists>
        </file>
      </activation>
      <properties>
        <galaxy.webroot>ROOT</galaxy.webroot>

        <!-- Suppresses the deployment of the normal maven artifacts when set to true. -->
        <galaxy.skip.deploy>false</galaxy.skip.deploy>

        <!-- Version of the ness-galaxy component. Can be overridden to select a newer version. -->
        <galaxy.scripts.version>1.1.0</galaxy.scripts.version>

        <!-- Selects the assembly for creating the tarball. -->
        <galaxy.packaging>standalone</galaxy.packaging>

        <!-- selects the launcher for the tarball. Defaults to the launcher matching the assembly. -->
        <galaxy.launcher>${galaxy.packaging}</galaxy.launcher>

        <!-- Default JDK to use for the tarball. -->
        <galaxy.jvm>1.7.0</galaxy.jvm>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>assemble-app</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <!-- must be false for galaxy builds, otherwise the jars will
                   have an extra qualifier -->
              <appendAssemblyId>false</appendAssemblyId>
              <descriptorRefs>
                <descriptorRef>${galaxy.packaging}-assembly</descriptorRef>
              </descriptorRefs>
            </configuration>
            <dependencies>
              <!-- This is correct. The assemblies live now inside ness-galaxy. -->
              <dependency>
                <groupId>com.nesscomputing.components</groupId>
                <artifactId>ness-galaxy</artifactId>
                <version>${galaxy.scripts.version}</version>
              </dependency>
            </dependencies>
          </plugin>
          
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>check-galaxy-build</id>
                <phase>validate</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>galaxy.mainclass</property>
                      <message>You must specify "galaxy.mainclass" as a Maven property for a Galaxy-enabled build.</message>
                    </requireProperty>
                    <requireProperty>
                      <property>galaxy.packaging</property>
                      <message>You must specify "galaxy.packaging" as a Maven property for a Galaxy-enabled build.  "standalone" is a good choice usually.</message>
                    </requireProperty>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <!-- Turn off regular deployment when building a galaxy tarball -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <executions>
              <execution>
                <id>default-deploy</id>
                <configuration>
                  <skip>${galaxy.skip.deploy}</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifestSections combine.children="append">
                  <manifestSection>
                    <name>${galaxy.mainclass}</name>
                    <manifestEntries>
                      <X-Ness-Binary>${project.artifactId}</X-Ness-Binary>
                      <X-Ness-Version>${project.version}</X-Ness-Version>
                      <X-Ness-Mode>galaxy</X-Ness-Mode>
                    </manifestEntries>
                  </manifestSection>
                </manifestSections>
              </archive>
            </configuration>
          </plugin>
        </plugins>
      </build>

      <dependencies>
        <dependency>
          <groupId>com.nesscomputing.components</groupId>
          <artifactId>ness-galaxy</artifactId>
          <version>${galaxy.scripts.version}</version>
          <type>tar.gz</type>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

    <!-- ======================================================================== -->
    <!-- =                                                                      = -->
    <!-- = Solo profile. Builds an executable jar from a project.               = -->
    <!-- =                                                                      = -->
    <!-- ======================================================================== -->

    <profile>
      <id>build-solo</id>
      <activation>
        <file>
          <exists>.build-solo</exists>
        </file>
      </activation>
      <properties>
        <!-- Suppresses the deployment of the normal maven artifacts when set to true. -->
        <ness.solo.skip.deploy>false</ness.solo.skip.deploy>
      </properties>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>solo</shadedClassifierName>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>${ness.solo.mainclass}</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </plugin>

          <!-- Turn off regular deployment when building a solo jar -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <executions>
              <execution>
                <id>default-deploy</id>
                <configuration>
                  <skip>${ness.solo.skip.deploy}</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
          
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>check-solo-build</id>
                <phase>validate</phase>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>ness.solo.mainclass</property>
                      <message>You must specify "ness.solo.mainclass" as a Maven property for a solo build.</message>
                    </requireProperty>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifestSections combine.children="append">
                  <manifestSection>
                    <name>${ness.solo.mainclass}</name>
                    <manifestEntries>
                      <X-Ness-Binary>${project.artifactId}</X-Ness-Binary>
                      <X-Ness-Version>${project.version}</X-Ness-Version>
                      <X-Ness-Mode>solo</X-Ness-Mode>
                    </manifestEntries>
                  </manifestSection>
                </manifestSections>
              </archive>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
