<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

	<!-- 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. -->

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.apache.karaf</groupId>
		<artifactId>karaf</artifactId>
		<version>4.0.1</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<artifactId>manual</artifactId>
	<name>Apache Karaf :: Manual</name>
	<packaging>war</packaging>

	<properties>
		<must-succeed>false</must-succeed>
		<manual.dir>${project.build.directory}/manual</manual.dir>
		<manual>${manual.dir}/manual-${project.version}</manual>
		<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.version>1.4.0</scalate.version>
		<wikitext.version>1.3</wikitext.version>
		<scalate.editor>${env.SCALATE_EDITOR}</scalate.editor>
		<scalate.mode>production</scalate.mode>
		<scalate.workdir>${project.build.directory}/scalateWorkDir</scalate.workdir>
		<karaf.version>${project.version}</karaf.version>
		<maven.wagon.version>1.0-beta-6</maven.wagon.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.fusesource.scalate</groupId>
			<artifactId>scalate-wikitext</artifactId>
			<version>${scalate.version}</version>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.scala-lang</groupId>
			<artifactId>scala-library</artifactId>
			<version>2.8.1</version>
		</dependency>
		<dependency>
			<groupId>org.scala-lang</groupId>
			<artifactId>scala-compiler</artifactId>
			<version>2.8.1</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<configuration>
					<useDefaultDelimiters>false</useDefaultDelimiters>
					<delimiters>
						<delimiter>${*}</delimiter>
					</delimiters>
				</configuration>
				<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>
				<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>
                                       <!--
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>install</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${manual}.html</file>
                                    <type>html</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                                       -->
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.karaf.tooling</groupId>
				<artifactId>karaf-maven-plugin</artifactId>
				<version>${project.version}</version>
				<executions>
					<execution>
						<id>generate-commands-help</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>commands-generate-help</goal>
						</goals>
						<configuration>
							<format>conf</format>
							<targetFolder>${project.build.directory}/webapp/commands/</targetFolder>
							<classLoader>plugin</classLoader>
						</configuration>
					</execution>
				</executions>
				<dependencies>
					<!-- Commands for help generation -->
					<dependency>
						<groupId>org.apache.karaf.shell</groupId>
						<artifactId>org.apache.karaf.shell.commands</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.shell</groupId>
						<artifactId>org.apache.karaf.shell.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.log</groupId>
						<artifactId>org.apache.karaf.log.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.obr</groupId>
						<artifactId>org.apache.karaf.obr.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.bundle</groupId>
						<artifactId>org.apache.karaf.bundle.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.bundle</groupId>
						<artifactId>org.apache.karaf.bundle.springstate</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.service</groupId>
						<artifactId>org.apache.karaf.service.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.system</groupId>
						<artifactId>org.apache.karaf.system.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.shell</groupId>
						<artifactId>org.apache.karaf.shell.ssh</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.web</groupId>
						<artifactId>org.apache.karaf.web.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.wrapper</groupId>
						<artifactId>org.apache.karaf.wrapper.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.instance</groupId>
						<artifactId>org.apache.karaf.instance.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.diagnostic</groupId>
						<artifactId>org.apache.karaf.diagnostic.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.features</groupId>
						<artifactId>org.apache.karaf.features.command</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.jaas</groupId>
						<artifactId>org.apache.karaf.jaas.command</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.scr</groupId>
						<artifactId>org.apache.karaf.scr.command</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.jdbc</groupId>
						<artifactId>org.apache.karaf.jdbc.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.jms</groupId>
						<artifactId>org.apache.karaf.jms.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.jndi</groupId>
						<artifactId>org.apache.karaf.jndi.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.config</groupId>
						<artifactId>org.apache.karaf.config.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.http</groupId>
						<artifactId>org.apache.karaf.http.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.kar</groupId>
						<artifactId>org.apache.karaf.kar.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.package</groupId>
						<artifactId>org.apache.karaf.package.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.profile</groupId>
						<artifactId>org.apache.karaf.profile.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.scheduler</groupId>
						<artifactId>org.apache.karaf.scheduler.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.karaf.subsystem</groupId>
						<artifactId>org.apache.karaf.subsystem.core</artifactId>
						<version>${project.version}</version>
					</dependency>
					<!-- Additional Required Dependencies -->
					<dependency>
						<groupId>org.apache.felix</groupId>
						<artifactId>org.apache.felix.gogo.runtime</artifactId>
						<version>${felix.gogo.version}</version>
					</dependency>
					<dependency>
						<groupId>org.osgi</groupId>
						<artifactId>org.osgi.core</artifactId>
						<version>${osgi.version}</version>
					</dependency>
					<dependency>
						<groupId>org.osgi</groupId>
						<artifactId>org.osgi.compendium</artifactId>
						<version>${osgi.compendium.version}</version>
					</dependency>
					<dependency>
						<groupId>org.apache.felix</groupId>
						<artifactId>org.apache.felix.bundlerepository</artifactId>
						<version>${felix.bundlerepository.version}</version>
					</dependency>
				</dependencies>
			</plugin>
            <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webResources>
						<resource>
							<directory>${project.build.directory}/webapp/</directory>
						</resource>
					</webResources>
					<archive>
						<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>7.1.5.v20100705</version>
				<configuration>
                    <!-- When editing the conf files, you can comment this line to run
                        mvn jetty:run
                       to have a live web site
                    -->
					<webAppSourceDirectory>${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.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.4.0</version>
				<executions>
					<execution>
						<id>bundle-manifest</id>
						<phase>process-classes</phase>
						<goals>
							<goal>manifest</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<supportedProjectTypes>
						<supportedProjectType>jar</supportedProjectType>
						<supportedProjectType>bundle</supportedProjectType>
						<supportedProjectType>war</supportedProjectType>
					</supportedProjectTypes>
					<instructions>
						<Import-Package>
				                            javax.servlet,
                            				    javax.servlet.http,
                            				    javax.servlet.jsp;resolution:=optional,
                            				    javax.servlet.jsp.el;resolution:=optional,
                            				    org.apache.commons.logging;resolution:=optional;provider=paxlogging,
                            				    org.apache.commons.logging.impl;resolution:=optional;provider=paxlogging,
                            				    org.apache.log4j;resolution:=optional;provider=paxlogging,
                            				    org.apache.log4j.spi;resolution:=optional;provider=paxlogging,
                            				    org.apache.log4j.xml;resolution:=optional;provider=paxlogging,
                            			            org.slf4j;resolution:=optional;provider=paxlogging,
                            				    org.slf4j.helpers;resolution:=optional;provider=paxlogging,
                            			            org.slf4j.spi;resolution:=optional;provider=paxlogging,
                            				    org.osgi.framework,
                                                            javax.swing.tree,
             						    org.osgi.service.packageadmin
						</Import-Package>
						<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
						<Embed-Directory>WEB-INF/lib</Embed-Directory>
						<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
						<Embed-Transitive>true</Embed-Transitive>
						<Web-ContextPath>/karaf-doc</Web-ContextPath>
					</instructions>
				</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 site with Karaf manual</checkinComment>
					<pubScmUrl>scm:svn:https://svn.apache.org/repos/asf/karaf/site/production/manual/latest</pubScmUrl>
					<content>${project.build.directory}/sitegen</content>
				</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>scalate-manual</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			
			<build>
				<plugins>
					<plugin>
		                <groupId>org.fusesource.scalate</groupId>
		                <artifactId>maven-scalate-plugin</artifactId>
		                <version>${scalate.version}</version>
		                <executions>
		                    <execution>
		                        <id>generate-htmls</id>
		                        <phase>prepare-package</phase>
		                        <goals>
		                            <goal>sitegen-no-fork</goal>
		                        </goals>
		                        <configuration>
		                            <warSourceDirectory>${project.build.directory}/webapp</warSourceDirectory>
		                        </configuration>
		                    </execution>
		                </executions>
		                <configuration>
		                    <remoteServerId>people.apache.org</remoteServerId>
		                    <remoteServerUrl>scp://people.apache.org/www/karaf.apache.org/manual/${karaf.version}
		                    </remoteServerUrl>
		                </configuration>
		                <dependencies>
		                    <dependency>
		                        <groupId>org.apache.maven.wagon</groupId>
		                        <artifactId>wagon-ssh</artifactId>
		                        <version>${maven.wagon.version}</version>
		                    </dependency>
		                    <dependency>
		                        <groupId>org.fusesource.wikitext</groupId>
		                        <artifactId>confluence-core</artifactId>
		                        <version>${wikitext.version}</version>
		                    </dependency>
		                </dependencies>
		            </plugin>
		            <plugin>
		                <groupId>org.apache.maven.plugins</groupId>
		                <artifactId>maven-antrun-plugin</artifactId>
		                <executions>
		                    <execution>
		                        <id>create-manual</id>
		                        <phase>package</phase>
		                        <goals>
		                            <goal>run</goal>
		                        </goals>
		                        <configuration>
		                            <tasks>
		                                <mkdir dir="${manual.dir}" />
		                                <move file="${project.build.directory}/sitegen/manual.html" tofile="${manual}.html" />
		                                <echo message="Generating PDF using Prince XML (http://www.princexml.com/)" />
		                                <exec executable="prince">
		                                    <arg value="${manual}.html" />
		                                    <arg value="${manual}.pdf" />
		                                    <arg value="--log" />
		                                    <arg value="${project.build.directory}/prince.log" />
		                                </exec>
		                                <attachartifact file="${manual}.html" type="html" />
		                                <attachartifact file="${manual}.pdf" type="pdf" />
		                            </tasks>
		                        </configuration>
		                    </execution>
		                </executions>
		            </plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>pdf-manual</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-manual</id>
								<phase>install</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<tasks>
										<mkdir dir="${manual.dir}" />
                                        <move file="${project.build.directory}/sitegen/manual.html" tofile="${manual}.html" />
                                        <echo message="Generating PDF using Prince XML (http://www.princexml.com/)" />
										<exec executable="prince">
											<arg value="${manual}.html" />
											<arg value="${manual}.pdf" />
											<arg value="--log" />
											<arg value="${project.build.directory}/prince.log" />
										</exec>
									</tasks>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-artifacts</id>
								<phase>install</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<artifacts>
										<artifact>
											<file>${manual}.pdf</file>
											<type>pdf</type>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>asciidoc</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctor-maven-plugin</artifactId>
						<version>1.5.2</version>
						<executions>
							<execution>
								<id>output-html</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<sourceHighlighter>coderay</sourceHighlighter>
									<backend>html5</backend>
									<attributes>
										<toc />
										<linkcss>false</linkcss>
										<doctype>book</doctype>
									</attributes>
								</configuration>
							</execution>
						</executions>
						<configuration>
							<sourceDirectory>src/main/asciidoc</sourceDirectory>
							<headerFooter>true</headerFooter>
							<imagesDir>../resources/images</imagesDir>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>release</id>
			<properties>
				<must-succeed>true</must-succeed>
			</properties>
		</profile>
	</profiles>

</project>

