<!--
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.
-->
<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">
  
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.directory.project</groupId>
    <artifactId>project</artifactId>
    <version>32</version>
  </parent>

  <groupId>org.apache.directory.shared</groupId>
  <artifactId>manuals</artifactId>
  <version>2.0.0-M4-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>ApacheDS Manuals</name>

  <properties>
    <distMgmtSiteUrl>scpexe://people.apache.org/www/directory.apache.org/apacheds</distMgmtSiteUrl>
  </properties>

  <issueManagement>
    <system>JIRA</system>
    <url>http://issues.apache.org/jira/browse/DIRSERVER</url>
  </issueManagement>

  <distributionManagement>
    <site>
      <id>apache.release</id>
      <url>${distMgmtSiteUrl}</url>
    </site>
  </distributionManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <configuration>
            <excludeSubProjects>false</excludeSubProjects>
            <excludes>
              <!-- MAVEN_DEFAULT_EXCLUDES -->
              <exclude>**/target/**/*</exclude>
              <exclude>**/cobertura.ser</exclude>
              <!-- ECLIPSE_DEFAULT_EXCLUDES -->
              <exclude>**/.classpath</exclude>
              <exclude>**/.project</exclude>
              <exclude>**/.settings/**/*</exclude>
              <!-- IDEA_DEFAULT_EXCLUDES -->
              <exclude>**/*.iml</exclude>
              <exclude>**/*.ipr</exclude>
              <exclude>**/*.iws</exclude>
              <!-- MANIFEST_MF_EXCLUDES -->
              <exclude>**/MANIFEST.MF</exclude>
              <!-- Missing license header in dependency reduced pom, see http://jira.codehaus.org/browse/MSHADE-48 -->
              <exclude>**/dependency-reduced-pom.xml</exclude>
              <!-- LDIF_FILES_EXCLUDES -->
              <exclude>**/*.ldif</exclude>
              <exclude>**/*.schema</exclude>
              <exclude>**/*.css</exclude>
              <!-- LOG_FILES_EXCLUDES -->
              <exclude>**/*.log</exclude>
              <exclude>**/*.confluence</exclude>
              <exclude>**/*.txt</exclude>
            </excludes>
          </configuration>
         </plugin>
      </plugins>
    </pluginManagement>

    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
      </extension>
    </extensions>  
    <!-- ======================================= -->
    <!-- ATTENTION                               -->
    <!-- Order of the plugins matters!           -->
    <!-- 1. maven-antrun-plugin                  -->
    <!-- 2. maven-dependency-plugin              -->
    <!-- 3. docbkx-maven-plugin                  -->
    <!-- 4. maven-assembly-plugin                -->
    <!-- 5. maven-site-plugin                    -->
    <!-- ======================================= -->
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>convert-basic-confluence</id>
            <phase>pre-site</phase>
            <configuration>
              <target>
                <!-- choose all files listed in book.txt -->
                <loadfile srcfile="${basedir}/src/ldap-api-user-guide-confluence/book.txt" property="inputfiles">
                  <filterchain>
                    <tokenfilter>
                      <replacestring from="\n" to=","/>
                    </tokenfilter>
                  </filterchain>
                </loadfile>
                <!-- concat all files listed in book.txt to a single file -->
                <concat destfile="${project.build.directory}/generated-sources/ldap-api-user-guide-confluence/book.confluence" append="false" fixlastline="yes">
                  <filelist dir="${basedir}/src/ldap-api-user-guide-confluence" files="${inputfiles}"/>
                </concat>
                <!-- load eclispe mylyn wikitext ant task -->
                <path id="wikitext.classpath">
                  <fileset dir="${basedir}/lib">
                    <include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
                  </fileset>
                </path>
                <taskdef classpathref="wikitext.classpath"
                        resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" />
                <!-- convert single confluence wiki file to docbook -->
                <wikitext-to-docbook markupLanguage="Confluence" doctype=""
                  bookTitle="Apache LDAP API User's Guide v${project.version}">
                  <fileset dir="${project.build.directory}/generated-sources/ldap-api-user-guide-confluence">
                    <include name="book.confluence"/>
                  </fileset>
                </wikitext-to-docbook>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
          <id>extract-images-from-docbook-xsl</id>
          <phase>pre-site</phase>
          <configuration>
            <artifactItems>
              <artifactItem>
                <artifactId>docbook-xsl</artifactId>
                <groupId>net.sf.docbook</groupId>
                <version>1.76.1</version>
                <classifier>ns-resources</classifier>
                <type>zip</type>
              </artifactItem>
            </artifactItems>
            <includes>**\/*.gif</includes>
            <outputDirectory>${project.build.directory}/docbook-xsl</outputDirectory>
          </configuration>
          <goals>
          <goal>unpack</goal>
          </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!-- http://docbkx-tools.sourceforge.net/docbkx-maven-plugin/plugin-info.html -->
        <groupId>com.agilejava.docbkx</groupId>
        <artifactId>docbkx-maven-plugin</artifactId>
        <!--
        Not sure if we can use this when scoping it "runtime". Because of license issues we can't redistribute it.
        But scoping it runtime it may be OK.
        TODO check license issue.
        http://xmlgraphics.apache.org/fop/0.95/hyphenation.html#license-issues
        <dependencies>
          <dependency>
            <groupId>net.sf.offo</groupId>
            <artifactId>fop-hyph</artifactId>
            <version>1.2</version>
            <scope>runtime</scope>
          </dependency>
        </dependencies>
        -->

        <configuration>
          <!-- shared configuration -->
          <!-- <tocSectionDepth>2</tocSectionDepth> -->
          <chunkedOutput>true</chunkedOutput>
          <includes>book.xml</includes>
          <draftMode>yes</draftMode>
          <xincludeSupported>true</xincludeSupported>
          <paperType>A4</paperType>
          <fop1Extensions>1</fop1Extensions>
          <htmlCustomization>${basedir}/src/docbkx-stylesheet/html/docbook.xsl</htmlCustomization>
          <foCustomization>${basedir}/src/docbkx-stylesheet/fo/docbook.xsl</foCustomization>
        </configuration>

        <executions>
          <execution>
            <id>gen-html-ldap-api-confluence</id>
            <phase>pre-site</phase>
            <goals>
              <goal>generate-html</goal>
            </goals>
            <configuration>
              <!-- per execution configuration -->
              <sourceDirectory>${project.build.directory}/generated-sources/ldap-api-user-guide-confluence</sourceDirectory>
              <targetDirectory>${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/html</targetDirectory>
              <imgSrcPath>${basedir}/src/ldap-api-user-guide-confluence/images/</imgSrcPath>
              <postProcess>
                <!-- Copy the images -->
                <copy todir="${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/html/book/images">
                  <fileset dir="${basedir}/src/ldap-api-user-guide-confluence/images" />
                </copy>
                <copy todir="${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/html/book/images">
                  <fileset dir="${project.build.directory}/docbook-xsl/docbook/images" />
                </copy>
                <!-- Copy the css -->
                <copy todir="${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/html/book">
                  <fileset dir="${basedir}/src/main/resources/css" />
                </copy>
                <!-- Copy the data -->
                <copy todir="${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/html/book/data">
                  <fileset dir="${basedir}/src/ldap-api-user-guide-confluence/data" />
                </copy>
              </postProcess>
            </configuration>
          </execution>

          <execution>
            <id>gen-pdf-ldap-api-confluence</id>
            <phase>pre-site</phase>
            <goals>
              <goal>generate-pdf</goal>
            </goals>
            <configuration>
              <!-- per execution configuration -->
              <sourceDirectory>${project.build.directory}/generated-sources/ldap-api-user-guide-confluence</sourceDirectory>
              <targetDirectory>${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/pdf</targetDirectory>
              <imgSrcPath>${basedir}/src/ldap-api-user-guide-confluence/images/</imgSrcPath>
              <admonGraphicsPath>${project.build.directory}/docbook-xsl/docbook/images/</admonGraphicsPath>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>gen-ldap-api-confluence-zip</id>
            <phase>pre-site</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <finalName>ldap-apiuser-guide-${project.version}</finalName>
              <appendAssemblyId>false</appendAssemblyId>
              <descriptors>
                <descriptor>${basedir}/src/main/assembly/ldap-api-user-guide.xml</descriptor>
              </descriptors>
              <outputDirectory>${project.build.directory}/docbook/manuals/ldap-api-user-guide-confluence-${project.version}/zip</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <generateReports>false</generateReports>
          <inputDirectory>target/docbook</inputDirectory>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <useReleaseProfile>false</useReleaseProfile>
          <goals>deploy site-deploy</goals>
          <arguments>-Prelease ${release.altDeploymentRepository} -DupdateReleaseInfo=true</arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/directory/documentation/apacheds-manuals/trunk</connection>
    <url>http://svn.apache.org/repos/asf/directory/documentation/apacheds-manuals/trunk</url>
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/documentation/apacheds-manuals/trunk</developerConnection>
  </scm>

</project>
