<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You 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/maven-v4_0_0.xsd">
  
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.activemq</groupId>
    <artifactId>apollo-project</artifactId>
    <version>1.7</version>
    <relativePath>..</relativePath>
  </parent>
  
  <artifactId>apollo-website</artifactId>

  <name>${project.artifactId}</name>
  <description>The Apollo Website</description>
  <packaging>pom</packaging>

  <properties>
    <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.fusesource.scalate</groupId>
      <artifactId>scalate-wikitext_2.10</artifactId>
      <version>${scalate-version}</version>
    </dependency>
    <dependency>
      <groupId>org.fusesource.scalate</groupId>
      <artifactId>scalate-page_2.10</artifactId>
      <version>${scalate-version}</version>
    </dependency>
    <dependency>
      <groupId>org.fusesource.scalamd</groupId>
      <artifactId>scalamd_2.10</artifactId>
      <version>${scalamd-version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${slf4j-version}</version>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>org.fusesource.scalate</groupId>
      <artifactId>scalate-test_2.10</artifactId>
      <version>${scalate-version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <sourceDirectory>ext</sourceDirectory>

    <plugins>
      <plugin>
        <inherited>true</inherited>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>${scala-plugin-version}</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <jvmArgs>
            <jvmArg>-Xmx1024m</jvmArg>
            <jvmArg>-Xss8m</jvmArg>
          </jvmArgs>
          <scalaVersion>${scala-version}</scalaVersion>
          <target>jvm-1.6</target>
        </configuration>
      </plugin>
      
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin-version}</version>
        <configuration>
          <forkMode>once</forkMode>
          <!-- these settings are mandatory to avoid SureFire giving a bogus system property to the web container -->
          <useSystemClassLoader>false</useSystemClassLoader>
          <useManifestOnlyJar>false</useManifestOnlyJar>
          <includes>
            <include>**/*Test.*</include>
          </includes>
          <excludes>
            <exclude>**/SomeFailingTest.*</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.fusesource.scalate</groupId>
        <artifactId>maven-scalate-plugin_2.10</artifactId>
        <version>${scalate-version}</version>
        
        <configuration>
          <webappDirectory>${basedir}/src</webappDirectory>
          <remoteServerId>apache-website</remoteServerId>
          <remoteServerUrl>${website-base-url}/versions/${project.version}/website/</remoteServerUrl>
        </configuration>
        
        <executions>
          <execution>
            <id>sitegen</id>
            <goals>
              <goal>sitegen</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
        
      </plugin>

      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-plugin-version}</version>
          <configuration>
            <webAppSourceDirectory>${basedir}/src</webAppSourceDirectory>
            <systemProperties>
              <systemProperty>
                <name>scalate.editor</name>
                <value>${env.SCALATE_EDITOR}</value>
              </systemProperty>
              <systemProperty>
                <name>scalate.workdir</name>
                <value>${basedir}/target/_scalate</value>
              </systemProperty>
              <systemProperty>
                <name>scalate.mode</name>
                <value>development</value>
              </systemProperty>
            </systemProperties>
            <scanIntervalSeconds>0</scanIntervalSeconds>
          </configuration>
        
      </plugin>
      
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <configuration>
              <tasks>
                <mkdir dir="${basedir}/target/sitegen/documentation/schema" />
                <copy file="${basedir}/../apollo-dto/target/schema/org/apache/activemq/apollo/dto/apollo.xsd" tofile="${basedir}/target/sitegen/documentation/schema/apollo.xsd" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.fusesource.mvnplugins</groupId>
        <artifactId>maven-linkchecker-plugin</artifactId>
        <version>${mvnplugins-version}</version>
        <configuration>
          <excludedLinks>
            <value>http://github.com/</value>
            <value>http://git.or.cz/</value>
            <value>http://localhost:8080/</value>
            <value>http://repo.fusesource.com/</value>
            <value>http://search.twitter.com/</value>
            <value>http://www.chengin.com/</value>
          </excludedLinks>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
  
  <profiles>
    
    <!-- We only include the java doc when doing a release build since
         that's when the javadoc actually gets generated -->
    <profile>
      <id>apache-release</id>

      <dependencies>        
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-dto</artifactId>
          <version>${project.version}</version>
          <classifier>javadoc</classifier>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-broker</artifactId>
          <version>${project.version}</version>
          <classifier>scaladoc</classifier>
          <scope>test</scope>
        </dependency>    
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-util</artifactId>
          <version>${project.version}</version>
          <classifier>scaladoc</classifier>
          <scope>test</scope>
        </dependency>    

      </dependencies>        
      <build>
        
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.2</version>
            <executions>
              <execution>
                <id>unpack</id>
                <phase>package</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.apache.activemq</groupId>
                      <artifactId>apollo-dto</artifactId>
                      <classifier>javadoc</classifier> 
                      <outputDirectory>${basedir}/target/sitegen/documentation/api/apollo-dto</outputDirectory>
                    </artifactItem>
                    <artifactItem>
                      <groupId>org.apache.activemq</groupId>
                      <artifactId>apollo-broker</artifactId>
                      <classifier>scaladoc</classifier> 
                      <outputDirectory>${basedir}/target/sitegen/documentation/api/apollo-broker</outputDirectory>
                    </artifactItem>
                    <artifactItem>
                      <groupId>org.apache.activemq</groupId>
                      <artifactId>apollo-util</artifactId>
                      <classifier>scaladoc</classifier> 
                      <outputDirectory>${basedir}/target/sitegen/documentation/api/apollo-util</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    
    <profile>
      <id>deploy-website</id>
      <activation>
        <property>
          <name>java.vm.name</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.fusesource.scalate</groupId>
            <artifactId>maven-scalate-plugin_2.10</artifactId>
            <version>${scalate-version}</version>
        
            <executions>
              <execution>
                <id>deploy</id>
                <goals>
                  <goal>deploy</goal>
                </goals>
                <phase>deploy</phase>
              </execution> 
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>


    <profile>
      <id>ibmjdk</id>
      <activation>
        <file>
          <exists>${java.home}/../lib/tools.jar</exists>
        </file>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-antrun-plugin</artifactId>
              <dependencies>
                <dependency>
                  <groupId>com.sun</groupId>
                  <artifactId>tools</artifactId>
                  <!--the real JDK version could be 1.5 or 1.6-->
                  <version>1.5.0</version>
                  <scope>system</scope>
                  <optional>true</optional>
                  <systemPath>${java.home}/../lib/tools.jar</systemPath>
                </dependency>
              </dependencies>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>    
  </profiles>
            
</project>

