<?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-scala</artifactId>
    <version>1.0-beta4</version>
    <relativePath>../apollo-scala</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>
    <website-server-id>apollo-website</website-server-id>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.fusesource.scalate</groupId>
      <artifactId>scalate-wikitext</artifactId>
      <version>${scalate-version}</version>
    </dependency>
    <dependency>
      <groupId>org.fusesource.scalate</groupId>
      <artifactId>scalate-page</artifactId>
      <version>${scalate-version}</version>
    </dependency>
    <dependency>
      <groupId>org.fusesource.scalamd</groupId>
      <artifactId>scalamd</artifactId>
      <version>${scalamd-version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${slf4j-version}</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>${jackson-version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>${jackson-version}</version>
    </dependency>
    
    <!-- testing -->
    <dependency>
      <groupId>org.fusesource.scalate</groupId>
      <artifactId>scalate-test</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>
        <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</artifactId>
        <version>${scalate-version}</version>
        
        <configuration>
          <webappDirectory>${basedir}/src</webappDirectory>
          <remoteServerId>${website-server-id}</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>
          <execution>
            <id>deploy</id>
            <goals>
              <goal>deploy</goal>
            </goals>
            <phase>deploy</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>
        <groupId>com.sun.tools.jxc.maven2</groupId>
        <artifactId>maven-jaxb-schemagen-plugin</artifactId>
        <version>1.3-dev</version>
        <dependencies>
           <dependency>
              <groupId>javax.xml.bind</groupId>
              <artifactId>jaxb-api</artifactId>
              <version>${jaxb-api-version}</version>
           </dependency>
           <dependency>
              <groupId>com.sun.xml.bind</groupId>
              <artifactId>jaxb-impl</artifactId>
              <version>${jaxb-version}</version>
           </dependency>
           <dependency>
              <groupId>com.sun.xml.bind</groupId>
              <artifactId>jaxb-xjc</artifactId>
              <version>${jaxb-version}</version>
           </dependency>
        </dependencies>
        
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <destdir>${basedir}/target/sitegen/documentation/schema</destdir>
              <srcdir>${basedir}/..</srcdir>
              <includes>
                <include>**/package-info.java</include>
                <include>**/*DTO.java</include>
              </includes>
              <excludes>
                <exclude>apollo-hawtdb/**</exclude>
                <exclude>apollo-cassandra/**</exclude>
                <exclude>apollo-openwire/**</exclude>
                <exclude>**/.git/**</exclude>
                <exclude>**/.svn/**</exclude>
              </excludes>
              <schemas>
                <schema>
                  <namespace>http://activemq.apache.org/schema/activemq/apollo</namespace>
                  <file>apollo.xsd</file>
                </schema>
              </schemas>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <phase>compile</phase>
            <configuration>
              <tasks>
                <replace token="&lt;xs:sequence&gt;" value="&lt;xs:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;&lt;xs:choice&gt;" dir="${basedir}/target/sitegen/documentation/schema">
                  <include name="**/*.xsd" />
                </replace>
                <replace token="&lt;/xs:sequence&gt;" value="&lt;/xs:choice&gt;&lt;/xs:choice&gt;" dir="${basedir}/target/sitegen/documentation/schema">
                  <include name="**/*.xsd" />
                </replace>
              </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>1.0-SNAPSHOT</version>
          <classifier>javadoc</classifier>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-broker</artifactId>
          <version>1.0-SNAPSHOT</version>
          <classifier>scaladoc</classifier>
          <scope>test</scope>
        </dependency>    
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-transport</artifactId>
          <version>1.0-SNAPSHOT</version>
          <classifier>scaladoc</classifier>
          <scope>test</scope>
        </dependency>    
        <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>apollo-util</artifactId>
          <version>1.0-SNAPSHOT</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-transport</artifactId>
                      <classifier>scaladoc</classifier> 
                      <outputDirectory>${basedir}/target/sitegen/documentation/api/apollo-transport</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>
  </profiles>
            
</project>

