<?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>5</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <artifactId>site</artifactId>
    <name>Apache ServiceMix :: Site</name>
    <version>1.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>
        <jetty-war-dir>${project.build.directory}/webapp/</jetty-war-dir>

        <scalate.editor>${env.SCALATE_EDITOR}</scalate.editor>
        <scalate.mode>production</scalate.mode>
        <scalate.workdir>${project.build.directory}/scalateWorkDir</scalate.workdir>

        <logback.version>1.0.9</logback.version>
        <scala.version>2.11.0</scala.version>
        <scalate.version>1.7.1</scalate.version>
        <slf4j.version>1.6.1</slf4j.version>
        <wikitext.version>1.4</wikitext.version>

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

    <repositories>
        <repository>
            <id>fusesource</id>
            <name>Fusesource Maven Repository</name>
            <url>http://repo.fusesource.com/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.scalatra.scalate</groupId>
            <artifactId>scalate-wikitext_2.11</artifactId>
            <version>${scalate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.fusesource.wikitext</groupId>
            <artifactId>wikitext-core</artifactId>
            <version>${wikitext.version}</version>
        </dependency>
        <dependency>
            <groupId>org.fusesource.wikitext</groupId>
            <artifactId>confluence-core</artifactId>
            <version>${wikitext.version}</version>
        </dependency>
        <dependency>
            <groupId>org.scalatra.scalate</groupId>
            <artifactId>scalate-page_2.11</artifactId>
            <version>${scalate.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
    		<dependency>
			      <groupId>org.scala-lang</groupId>
			      <artifactId>scala-library</artifactId>
			      <version>${scala.version}</version>
		    </dependency>
		    <dependency>
			      <groupId>org.scala-lang</groupId>
			      <artifactId>scala-compiler</artifactId>
			      <version>${scala.version}</version>
		    </dependency>

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

    <build>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.15.2</version>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </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>${project.build.directory}/webapp</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/webapp</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/webapp</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scalatra.scalate</groupId>
                <artifactId>maven-scalate-plugin_2.11</artifactId>
                <version>${scalate.version}</version>
                <executions>
                    <execution>
                        <id>generate-htmls</id>
                        <!-- <phase>compile</phase> -->
                        <goals>
                            <goal>sitegen</goal>
                        </goals>
                        <!-- <configuration>
                            <warSourceDirectory>${project.build.directory}/webapp</warSourceDirectory>
                        </configuration> -->
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.fusesource.wikitext</groupId>
                        <artifactId>confluence-core</artifactId>
                        <version>${wikitext.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.fusesource.wikitext</groupId>
                        <artifactId>wikitext-core</artifactId>
                        <version>${wikitext.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.8.v20121106</version>
                <configuration>
                    <!-- When editing the conf files, you can comment this line to run
                        mvn jetty:run
                       to have a live web site
                    -->
                    <webAppSourceDirectory>src/main/webapp;${jetty-war-dir}</webAppSourceDirectory>

                    <systemProperties>
                        <systemProperty>
                            <name>scalate.editor</name>
                            <value>${scalate.editor}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>scalate.workdir</name>
                            <value>${scalate.workdir}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>scalate.mode</name>
                            <value>${scalate.mode}</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 main website contents</checkinComment>
                    <pubScmUrl>scm:svn:https://svn.apache.org/repos/asf/servicemix/site/production</pubScmUrl>
                    <content>${project.build.directory}/sitegen</content>
                    <ignorePathsToDelete>
                        <ignorePathToDelete>docs/**</ignorePathToDelete>
                    </ignorePathsToDelete>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.fusesource.scalate</groupId>
                <artifactId>maven-scalate-plugin</artifactId>
                <version>${scalate.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>live</id>
            <properties>
                <jetty-war-dir>${basedir}/src/main/webapp/</jetty-war-dir>
                <scalate.mode>development</scalate.mode>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <must-succeed>true</must-succeed>
            </properties>
        </profile>
    </profiles>

</project>

