<?xml version="1.0" encoding="UTF-8"?>
<!--
  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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.nifi</groupId>
        <artifactId>nifi</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <packaging>pom</packaging>
    <artifactId>nifi-docs</artifactId>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-asciidoc</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/main/asciidoc</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoc</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>            
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.2</version>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>${project.build.directory}/asciidoc</sourceDirectory>
                    <backend>html5</backend>
                    <attributes>
                        <imagesdir>./images</imagesdir>
                        <icons>font</icons>
                        <toc>true</toc>
                        <docVersion>${project.version}</docVersion>
                        <sectanchors>true</sectanchors>
                        <idprefix />
                        <idseparator>-</idseparator>
                        <docinfo1>true</docinfo1>
                        <stylesheet>asciidoc-mod.css</stylesheet>
                    </attributes>
                </configuration>
            </plugin>
            <!-- This plugin is used to insert the Apache License into the output HMTL because
            AsciiDoc doesn't appear to provide a mechanism for doing this. -->
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <filesToInclude>${project.build.directory}/generated-docs/**.html</filesToInclude>
                    <regex>true</regex>
                    <regexFlags>
                        <regexFlag>DOTALL</regexFlag>
                        <regexFlag>MULTILINE</regexFlag>
                    </regexFlags>
                    <token>^(.*)$</token>
                    <value>
&lt;!--
                        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.
                        --&gt;
                        $1
                    </value>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <configuration>
                    <excludes combine.children="append">
                        <!-- MIT license confirmed.  Excluding due to parse error-->
                        <exclude>src/main/asciidoc/asciidoc-mod.css</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <id>make shared resource</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/dependencies.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>            
        </plugins>
    </build>
</project>