<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>
  <parent>
    <groupId>org.overlord.apiman</groupId>
    <artifactId>apiman</artifactId>
    <version>1.0.0.Alpha3</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>apiman-docs</artifactId>
  <name>apiman-docs</name>
  <packaging>jdocbook</packaging>

  <build>
    <plugins>
      <plugin>
        <groupId>org.asciidoctor</groupId>
        <artifactId>asciidoctor-maven-plugin</artifactId>
        <version>0.1.4</version>
        <executions>
          <execution>
            <id>output-docbook</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>process-asciidoc</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <sourceDirectory>guide/en-US</sourceDirectory>
          <outputDirectory>target/docbook/en-US</outputDirectory>
          <backend>docbook</backend>
          <doctype>book</doctype>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jboss.maven.plugins</groupId>
        <artifactId>maven-jdocbook-plugin</artifactId>
        <version>2.3.8</version>
        <extensions>true</extensions>
        <dependencies>
          <dependency>
            <groupId>org.jboss.pressgang</groupId>
            <artifactId>pressgang-xslt-ns</artifactId>
            <version>2.0.2</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.pressgang</groupId>
            <artifactId>pressgang-jdocbook-style</artifactId>
            <type>jdocbook-style</type>
            <version>2.0.2</version>
          </dependency>
        </dependencies>
        <configuration>
          <sourceDocumentName>Guide.xml</sourceDocumentName>
          <sourceDirectory>target/docbook/</sourceDirectory>
          <imageResource>
            <directory>.</directory>
            <includes>
              <include>images/*</include>
            </includes>
          </imageResource>
          <formats>
            <format>
              <formatName>html</formatName>
              <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
              <finalName>index.html</finalName>
            </format>
            <format>
              <formatName>html_single</formatName>
              <stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
              <finalName>index.html</finalName>
            </format>
            <format>
              <formatName>pdf</formatName>
              <stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
              <finalName>S-RAMP_Reference_Guide.pdf</finalName>
            </format>
          </formats>
          <options>
            <xincludeSupported>true</xincludeSupported>
            <xmlTransformerType>saxon</xmlTransformerType>
            <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
            <!-- could also locate the docbook dependency and inspect its version... -->
            <docbookVersion>1.72.0</docbookVersion>
            <transformerParameters>
              <property>
                <name>javax.xml.parsers.DocumentBuilderFactory</name>
                <value>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</value>
              </property>
              <property>
                <name>javax.xml.parsers.SAXParserFactory</name>
                <value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
              </property>
            </transformerParameters>
          </options>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the 
          Maven build itself. -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.asciidoctor</groupId>
                    <artifactId>asciidoctor-maven-plugin</artifactId>
                    <versionRange>[0.1.4,)</versionRange>
                    <goals>
                      <goal>process-asciidoc</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.jboss.maven.plugins</groupId>
                    <artifactId>maven-jdocbook-plugin</artifactId>
                    <versionRange>[2.3.8,)</versionRange>
                    <goals>
                      <goal>generate</goal>
                      <goal>resources</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>upload-docs</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>upload-docs</id>
                <phase>deploy</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <scp sftp="true" trust="true" failonerror="false" keyfile="${keyfile}"
                      todir="overlord@filemgmt.jboss.org:/docs_htdocs/overlord/apiman/${project.version}">
                      <fileset dir="${project.build.directory}/docbook/publish/en-US" />
                    </scp>
                  </tasks>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.apache.ant</groupId>
                <artifactId>ant-jsch</artifactId>
                <version>1.8.2</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>