<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2009-2010 the original author or authors.
    See the notice.md file distributed with this work for additional
    information regarding copyright ownership.

    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/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.apache.servicemix</groupId>
        <artifactId>servicemix-pom</artifactId>
        <version>4</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.apache.servicemix</groupId>
    <artifactId>documentation</artifactId>
    <name>Apache ServiceMix Documentation</name>
    <version>6.0.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <prerequisites>
        <maven>3.0.0</maven>
    </prerequisites>

    <properties>
        <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
        <jetty-port>8080</jetty-port>
        <webapp.srcdir>${project.basedir}/src/main/webapp</webapp.srcdir>
        <webapp.dir>${project.build.directory}/webapp</webapp.dir>

        <pdf.required>false</pdf.required>

        <scala.version>2.10.0</scala.version>

        <scalate.version>1.6.1</scalate.version>
        <scalate.mode>production</scalate.mode>
        <scalate.workdir>${basedir}/target/scalateWorkDir</scalate.workdir>

        <camel.version>2.10.3</camel.version>
        <karaf.version>2.3.0</karaf.version>

        <servicemix.version>7.0.0-SNAPSHOT</servicemix.version>
        <servicemix.docs.location>7.x</servicemix.docs.location>

        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <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>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.0.9</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.2</version>
        </dependency>

        <!-- Scala -->
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-compiler</artifactId>
                <version>${scala.version}</version>
            </dependency>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-library</artifactId>
                <version>${scala.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.15.2</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generate-pdfs</id>
                        <phase>package</phase>
                        <goals>
                            <goal>script</goal>
                        </goals>
                        <configuration>
                            <includeScopes>plugin</includeScopes>
                            <scriptFile>src/main/scripts/GeneratePdfDocuments.scala</scriptFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <!-- Unpack the manual sources into the /karaf subdirectory -->
                        <id>unpack-developer-karaf-manual</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.karaf</groupId>
                                    <artifactId>manual</artifactId>
                                    <version>${karaf.version}</version>
                                    <type>war</type>
                                    <outputDirectory>${project.build.directory}/webapp</outputDirectory>
                                    <includes>developers-guide/*.conf</includes>
                                    <excludes>
                                        <!--
                                          security-framework.conf refers to the Karaf codebase,
                                          branding-console.conf does not build properly with Scalate 1.6.1
                                        -->
	                                    developers-guide/security-framework.conf, developers-guide/branding-console.conf, developers-guide/archetypes.conf
                                    </excludes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
		            <execution>
                        <!-- Unpack the manual sources into the /karaf subdirectory -->
                        <id>unpack-user-karaf-manual</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.karaf</groupId>
                                    <artifactId>manual</artifactId>
                                    <version>${karaf.version}</version>
                                    <type>war</type>
                                    <outputDirectory>${project.build.directory}/webapp</outputDirectory>
                                    <includes>users-guide/*.conf</includes>
                                    <excludes>
                                        users-guide/security-framework.conf, users-guide/provisioning-schema.conf
                                    </excludes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Unpack the commands documentation sources into the /commands -->
                        <id>unpack-karaf-commands</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.karaf</groupId>
                                    <artifactId>manual</artifactId>
                                    <version>${karaf.version}</version>
                                    <type>war</type>
                                    <outputDirectory>${project.build.directory}/webapp</outputDirectory>
                                    <includes>commands/*.conf</includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>filter</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${webapp.dir}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${webapp.srcdir}</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.fusesource.scalate</groupId>
                <artifactId>maven-scalate-plugin_2.10</artifactId>
                <version>${scalate.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>sitegen-no-fork</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <configuration>
                            <webappDirectory>${webapp.dir}</webappDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <warSourceDirectory>${webapp.dir}</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.8.v20121106</version>
                <configuration>
                    <webAppConfig>
                        <contextPath>/</contextPath>
                        <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection">
                            <resourcesAsCSV>${webapp.srcdir},${webapp.dir}</resourcesAsCSV>
                        </baseResource>
                    </webAppConfig>
                    <systemProperties>
                        <systemProperty>
                            <name>scalate.workdir</name>
                            <value>${scalate.workdir}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>scalate.mode</name>
                            <value>${scalate.mode}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>logback.configurationFile</name>
                            <value>${basedir}/src/etc/logback.xml</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-scm-publish-plugin</artifactId>
                <version>1.0-beta-2</version>
                <configuration>
                    <checkinComment>[scm-publish] Updating ServiceMix ${servicemix.docs.location} documentation contents</checkinComment>
                    <pubScmUrl>scm:svn:https://svn.apache.org/repos/asf/servicemix/site/production/docs/${servicemix.docs.location}</pubScmUrl>
                    <content>${project.build.directory}/sitegen</content>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.3</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>apache-release</id>
            <properties>
                <pdf.required>true</pdf.required>
            </properties>
        </profile>
    </profiles>

</project>

