<?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">
	<modelVersion>4.0.0</modelVersion>

	<artifactId>spring-shell-docs</artifactId>
	<name>Spring Shell Documentation</name>
	<packaging>jar</packaging>

	<parent>
		<groupId>org.springframework.shell</groupId>
		<artifactId>spring-shell-parent</artifactId>
		<version>2.0.0.RELEASE</version>
	</parent>
	
	<description>Spring Shell reference documentation</description>
	<properties>
		<asciidoctor.maven.plugin.version>1.5.5</asciidoctor.maven.plugin.version>
		<asciidoctorj.pdf.version>1.5.0-alpha.16</asciidoctorj.pdf.version>
		<asciidoctorj.version>1.5.6</asciidoctorj.version>
		<jruby.version>1.7.26</jruby.version>
	</properties>

	<!-- This project artificially depends on all others so that the javadoc plugin can consolidate everything.-->
	<dependencies>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell-core</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell-standard</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell-standard-commands</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell-shell1-adapter</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell-jcommander-adapter</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.beust</groupId>
			<artifactId>jcommander</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.shell</groupId>
			<artifactId>spring-shell-table</artifactId>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<!-- ASCIIDOC -->
			<plugin>
				<groupId>org.asciidoctor</groupId>
				<artifactId>asciidoctor-maven-plugin</artifactId>
				<version>${asciidoctor.maven.plugin.version}</version>
				<dependencies>
					<dependency>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctorj-pdf</artifactId>
						<version>${asciidoctorj.pdf.version}</version>
					</dependency>
					<!-- Comment this section to use the default jruby artifact provided by the plugin -->
					<dependency>
						<groupId>org.jruby</groupId>
						<artifactId>jruby-complete</artifactId>
						<version>${jruby.version}</version>
					</dependency>
					<!-- Comment this section to use the default AsciidoctorJ artifact provided by the plugin -->
					<dependency>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctorj</artifactId>
						<version>${asciidoctorj.version}</version>
					</dependency>
				</dependencies>
				<configuration>
					<sourceDocumentName>index.adoc</sourceDocumentName>
					<doctype>book</doctype>
					<attributes>
						<allow-uri-read>true</allow-uri-read>
						<attribute-missing>warn</attribute-missing>
						<project-version>${project.version}</project-version>
						<project-artifactId>${project.artifactId}</project-artifactId>
					</attributes>
				</configuration>
				<executions>
					<execution>
						<id>generate-html5</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>process-asciidoc</goal>
						</goals>
						<configuration>
							<backend>html5</backend>
							<attributes>
								<toc2 />
								<docinfo>shared-head</docinfo>
								<source-highlighter>coderay</source-highlighter>
							</attributes>
						</configuration>
					</execution>
					<execution>
						<id>generate-pdf</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>process-asciidoc</goal>
						</goals>
						<configuration>
							<backend>pdf</backend>
							<sourceHighlighter>coderay</sourceHighlighter>
							<attributes>
								<toc />
								<pagenums />
							</attributes>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- API DOCS -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>3.0.0-M1</version>
				<executions>
					<execution>
						<id>dependency-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>prepare-package</phase>
						<configuration>
							<includeDependencySources>true</includeDependencySources>
							<dependencySourceIncludes>
								<dependencySourceInclude>${project.groupId}:*</dependencySourceInclude>
							</dependencySourceIncludes>
							<dependencySourceExcludes>
								<!-- Exclude Spring Shell 1 -->
								<dependencySourceExclude>${project.groupId}:spring-shell</dependencySourceExclude>
							</dependencySourceExcludes>
							<quiet>true</quiet>
							<attach>false</attach>
							<links>
								<link>
									http://docs.spring.io/spring-framework/docs/current/javadoc-api/
								</link>
								<link>http://jcommander.org/apidocs/</link>
								<link>https://docs.spring.io/spring-shell/docs/1.2.0.RELEASE/api/</link>
							</links>
							<doclint>-missing</doclint>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!-- PACKAGE ASCIIDOC + API -->
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<id>zip-docs</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<descriptors>
								<descriptor>src/assembly/docs-zip.xml</descriptor>
							</descriptors>
							<appendAssemblyId>false</appendAssemblyId>
							<attach>false</attach>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>1.9.1</version>
				<executions>
					<execution>
						<id>attach-zip</id>
						<phase>package</phase>
						<goals>
							<goal>attach-artifact</goal>
						</goals>
						<configuration>
							<artifacts>
								<artifact>
									<file>${project.build.directory}/${project.artifactId}-${project.version}.zip</file>
									<type>zip;zip.type=docs;zip.deployed=false</type>
								</artifact>
							</artifacts>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

</project>
