<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">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.projectdarkstar</groupId>
  <artifactId>sgs</artifactId>
  <name>Project Darkstar Master POM</name>
  <packaging>pom</packaging>
  <version>8</version>
  <url>http://www.projectdarkstar.com</url>
  <description>
    This is the super POM inherited by all sgs modules
    It defines settings common to all projects
  </description>

  <!-- Require at least Maven version 2.0.8 to build -->
  <prerequisites>
    <maven>2.0.8</maven>
  </prerequisites>

  <build>

    <!-- This section defines global configuration of plugins
	 These plugin settings are not activated in child projects
	 unless the plugin is explicitly used -->
    <pluginManagement>

      <plugins>

	<!-- Default configuration for running unit tests -->
	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
	  <version>${surefire.version}</version>
          <configuration>
            <includes>
              <include>**/Test*.java</include>
            </includes>
	    <forkMode>always</forkMode>
	    <failIfNoTests>false</failIfNoTests>
	    <argLine>${test.jvm.args}</argLine>
	    <redirectTestOutputToFile>${test.output.hide}</redirectTestOutputToFile>
          </configuration>
	</plugin>
	
	<!-- The berkeleydb binary package must be retrieved and unpacked
	     Before the test phase so that they are available during
	     runtime of the unit tests.
	     To enable this dependency unpack, activate the unpack-bdb-binaries
	     execution id in the child POM -->
	<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>unpack-bdb-binaries</id>
              <goals>
		<goal>unpack</goal>
              </goals>
              <configuration>
		<artifactItems>
                  <artifactItem>
                    <groupId>com.projectdarkstar.ext.berkeleydb</groupId>
                    <artifactId>db-binaries</artifactId>
		    <type>zip</type>
                    <overWrite>false</overWrite>
                    <outputDirectory>
		      ${project.build.directory}/
		    </outputDirectory>
                  </artifactItem>
		</artifactItems>
              </configuration>
            </execution>
          </executions>
	</plugin>

	<!-- A sources jar can be attached by enabling
	     the attach-sources execution id of this plugin -->
	<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>

	<!-- A javadoc jar can be attached by enabling
	     the attach-javadocs execution id of this plugin -->
	<plugin>
	  <groupId>org.apache.maven.plugins</groupId>
	  <artifactId>maven-javadoc-plugin</artifactId>
	  <configuration>
            <links>
              <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
	      <link>http://mina.apache.org/report/1.1/apidocs/</link>
            </links>
          </configuration>
	  <executions>
	    <execution>
	      <id>attach-javadocs</id>
	      <goals>
		<goal>jar</goal>
	      </goals>
	      <configuration>
		<quiet>true</quiet>
	      </configuration>
	    </execution>
	  </executions>
	</plugin>

	<!-- The resource bundle executions should be activated in modules
	     that produce jars that require the license to be bundled
	     in the jar -->
	<plugin>
	  <groupId>org.apache.maven.plugins</groupId>
	  <artifactId>maven-remote-resources-plugin</artifactId>
	  <configuration>
	    <properties>
	      <projectYear>${projectYear}</projectYear>
	    </properties>
	  </configuration>
	  <executions>
	    <execution>
	      <id>include-gpl-license</id>
	      <goals>
		<goal>process</goal>
	      </goals>
	      <phase></phase>
	      <configuration>
		<resourceBundles>
		  <resourceBundle>com.projectdarkstar.tools.build:sgs-jar-resources-gpl:${sgs-jar-resources-gpl.version}</resourceBundle>
		</resourceBundles>
	      </configuration>
	    </execution>
	    <execution>
	      <id>include-bsd-license</id>
	      <goals>
		<goal>process</goal>
	      </goals>
	      <phase></phase>
	      <configuration>
		<resourceBundles>
		  <resourceBundle>com.projectdarkstar.tools.build:sgs-jar-resources-bsd:${sgs-jar-resources-bsd.version}</resourceBundle>
		</resourceBundles>
	      </configuration>
	    </execution>
	  </executions>
	</plugin>

      </plugins>
      
    </pluginManagement>

    <!-- This section enables plugins globally for all child projects
	 Any project inheriting from this POM will have these plugins
	 enabled and configured as shown unless they override those
	 settings -->
    <plugins>
      
      <!-- Global compiler configuration -->
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
	  <compilerArgument>-Xlint</compilerArgument>
	  <source>1.5</source>
	  <target>1.5</target>
	</configuration>
      </plugin>

      <!-- Global manifest generation configuration -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
	      <addClasspath>true</addClasspath>
              <addDefaultImplementationEntries>
		true
	      </addDefaultImplementationEntries>
              <addDefaultSpecificationEntries>
		true
	      </addDefaultSpecificationEntries>
            </manifest>
          </archive>
        </configuration>
      </plugin>

      <!-- Configure checkstyle to have custom dependency -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
	<dependencies>
	  <dependency>
	    <groupId>com.projectdarkstar.tools.build</groupId>
	    <artifactId>sgs-build-utilities</artifactId>
	    <version>${sgs-build-utilities.version}</version>
	  </dependency>
	</dependencies>
      </plugin>

    </plugins>

    <!-- Include the wagon-svn extension so we can deploy
	 to Maven2 repositories hosted in SVN repositories
	 on java.net -->
    <extensions>
      <extension>
        <groupId>org.jvnet.wagon-svn</groupId>
        <artifactId>wagon-svn</artifactId>
        <version>RELEASE</version>
      </extension>
    </extensions>

  </build>

  <!-- Library of dependencies used in any sub module of this project
       Define versions of dependencies in this file only to maintain
       consistency -->
  <dependencyManagement>
    <dependencies>
      <dependency>
	<groupId>junit</groupId>
	<artifactId>junit</artifactId>
	<version>${junit.version}</version>
	<scope>test</scope>
      </dependency>
      <dependency>
	<groupId>org.easymock</groupId>
	<artifactId>easymock</artifactId>
	<version>${easymock.version}</version>
	<scope>test</scope>
      </dependency>

      <dependency>
	<groupId>org.apache.mina</groupId>
	<artifactId>mina-core</artifactId>
	<version>${org.apache.mina.version}</version>
      </dependency>

      <dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-api</artifactId>
	<version>${slf4j-api.version}</version>
      </dependency>

      <dependency>
	<groupId>org.slf4j</groupId>
	<artifactId>slf4j-jdk14</artifactId>
	<version>${slf4j-jdk14.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-shared</artifactId>
	<version>${sgs-shared.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-api</artifactId>
	<scope>provided</scope>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server-javadoc</artifactId>
	<classifier>api</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-shared</artifactId>
	<classifier>sources</classifier>
	<version>${sgs-shared.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-server</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-tutorial-server</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-tutorial-server</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.server</groupId>
	<artifactId>sgs-tutorial-server-dist</artifactId>
	<type>zip</type>
	<version>${sgs.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-client</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-client-api</artifactId>
	<scope>provided</scope>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-client-javadoc</artifactId>
	<classifier>api</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-client</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-tutorial-client</artifactId>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-tutorial-client</artifactId>
	<classifier>sources</classifier>
	<version>${sgs.version}</version>
      </dependency>
      <dependency>
	<groupId>com.projectdarkstar.client</groupId>
	<artifactId>sgs-tutorial-client-dist</artifactId>
	<type>zip</type>
	<version>${sgs.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	<artifactId>db</artifactId>
	<version>${bdb.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	<artifactId>je</artifactId>
	<version>${bdb.je.version}</version>
      </dependency>

      <dependency>
	<groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	<artifactId>db-binaries</artifactId>
	<version>${bdb.version}</version>
	<type>zip</type>
      </dependency>

      <!-- for the sgs-build-utilities -->
      <dependency>
	<groupId>checkstyle</groupId>
	<artifactId>checkstyle</artifactId>
	<version>${checkstyle.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <!-- Profiles activated based on platform to set BDB properties
       The profile that is activated sets the bdb.lib.dir property 
       to the directory name of the bdb libraries in the bdb
       binary package for the platform in use.
       Note that these profiles are activated as configured for
       all children inheriting from this POM -->
  <profiles>
    <profile>
      <id>macosx-ppc</id>
      <properties>
	<bdb.lib.dir>macosx-ppc</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>mac</family>
	  <arch>ppc</arch>
	</os>
      </activation>
    </profile>

    <profile>
      <id>macosx-x86</id>
      <properties>
	<bdb.lib.dir>macosx-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>mac</family>
	  <arch>i386</arch>
	</os>
      </activation>
    </profile>

    <profile>
      <id>macosx-x86_64</id>
      <properties>
	<bdb.lib.dir>macosx-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>mac</family>
	  <arch>x86_64</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>solaris-x86</id>
      <properties>
	<bdb.lib.dir>solaris-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>SunOS</name>
	  <arch>x86</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>solaris-sparc</id>
      <properties>
	<bdb.lib.dir>solaris-sparc</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>SunOS</name>
	  <arch>sparc</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>linux-x86</id>
      <properties>
	<bdb.lib.dir>linux-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>Linux</name>
	  <arch>i386</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>linux-x86_64</id>
      <properties>
	<bdb.lib.dir>linux-x86_64</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <name>Linux</name>
	  <arch>x86_64</arch>
	</os>
      </activation>
    </profile>
    
    <profile>
      <id>win32-x86</id>
      <properties>
	<bdb.lib.dir>win32-x86</bdb.lib.dir>
      </properties>
      <activation>
	<os>
	  <family>windows</family>
	</os>
      </activation>
    </profile>

    <!-- profile enabled to test with BDB Java edition
	 This will set the run.bdb.env property to the BDB java
	 class rather than the native class. -->
    <profile>
      <id>bdb-java</id>
      <properties>
	<run.bdb.env>
	  com.sun.sgs.impl.service.data.store.db.je.JeEnvironment
	</run.bdb.env>
      </properties>
      <dependencies>
	<dependency>
	  <groupId>com.projectdarkstar.ext.berkeleydb</groupId>
	  <artifactId>je</artifactId>
	</dependency>
      </dependencies>
    </profile>
    
  </profiles>

  <!-- Release artifacts should be deployed to the java.net
       Maven2 repository
       SNAPSHOT artifacts should be deployed to the
       repository hosted in the games-darkstar java.net project -->
  <distributionManagement>
    <repository>
      <id>java.net-maven2-repository</id>
      <name>java.net Maven2 Repository</name>
      <url>java-net:/maven2-repository/trunk/www/repository/</url>
    </repository>
    <snapshotRepository>
      <id>games-darkstar-snapshot-repository</id>
      <name>games-darkstar SNAPSHOT Repository</name>
      <url>java-net:/games-darkstar/trunk/www/snapshots/</url>
      <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
  </distributionManagement>

  <!-- Include the java.net repository to retrieve dependent
       artifacts (such as wagon-svn) -->
  <repositories>
    <repository>
      <id>java.net</id>
      <name>java.net Maven2 Repository</name>
      <url>http://download.java.net/maven/2/</url>
      <layout>default</layout>
    </repository>
  </repositories>
  
  <!-- Configuration properties which should be consistent
       across all children POMS -->
  <properties>
    
    <projectYear>2008</projectYear>
    
    <!-- These two values should be overridden by children POMs
	 The reason for this is so that it is not necessary to do a
	 new release of this POM every time there is a new release
	 of the darkstar distributions -->
    <sgs.version>0</sgs.version>
    <sgs-shared.version>0</sgs-shared.version>

    <sgs-build-utilities.version>1.0</sgs-build-utilities.version>
    <sgs-jar-resources-gpl.version>1.0</sgs-jar-resources-gpl.version>
    <sgs-jar-resources-bsd.version>1.0</sgs-jar-resources-bsd.version>

    <bdb.version>4.5.20</bdb.version>
    <bdb.je.version>3.2.23</bdb.je.version>
    <junit.version>4.5</junit.version>
    <easymock.version>2.4</easymock.version>
    <org.apache.mina.version>1.1.0</org.apache.mina.version>
    <slf4j-api.version>1.4.0</slf4j-api.version>
    <slf4j-jdk14.version>1.4.0</slf4j-jdk14.version>

    <checkstyle.version>4.4</checkstyle.version>
    <!-- Locations of checkstyle files
	 Configure these in the individual modules that use the
	 checkstyle plugin -->
    <checkstyle.config>
      com/sun/sgs/tools/checkstyle/darkstar_checks.xml
    </checkstyle.config>
    <checkstyle.header.bsd>
      com/sun/sgs/tools/checkstyle/BSD.txt
    </checkstyle.header.bsd>
    <checkstyle.header.gpl>
      com/sun/sgs/tools/checkstyle/GPLv2.txt
    </checkstyle.header.gpl>
    <checkstyle.packageNames>
      com/sun/sgs/tools/checkstyle/packageNames.xml
    </checkstyle.packageNames>
    <!-- Checkstyle report level for unused imports
	 You can suppress these warnings altogether by setting the value
         to ignore. -->
    <checkstyle.unusedImports>warning</checkstyle.unusedImports>

    <surefire.version>2.4.3</surefire.version>

    <test.assertions>-ea:com.sun.sgs...</test.assertions>
    <test.max.heap>-Xmx1g</test.max.heap>
    <test.jvm.args>${test.assertions} ${test.max.heap}</test.jvm.args>
    <test.output.hide>true</test.output.hide>
    <test.bdb.cache.size>1000000</test.bdb.cache.size>

    <run.javapath>target/bdb-${bdb.version}/${bdb.lib.dir}/</run.javapath>
    <run.bdb.env>
      com.sun.sgs.impl.service.data.store.db.bdb.BdbEnvironment
    </run.bdb.env>

  </properties>

</project>
