<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.neo4j</groupId>
    <artifactId>parent</artifactId>
    <version>2.2.3</version>
    <relativePath>..</relativePath>
  </parent>
  <groupId>org.neo4j.doc</groupId>
  <artifactId>neo4j-manual</artifactId>
  <version>2.2.3</version>

  <name>Neo4j - Reference Manual</name>
  <description>Neo4j Reference Manual.</description>
  <url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>
  <packaging>pom</packaging>

  <properties>
    <short-name>manual</short-name>
    <docs.contents>${project.build.directory}/contents</docs.contents>
    <docs.sources>${docs.contents}/docs</docs.sources>
    <docs.javadocs>${project.build.directory}/javadoc</docs.javadocs>
    <docs.refcard>${project.build.directory}/refcard</docs.refcard>
    <docs.sourcecode>${docs.contents}/sources</docs.sourcecode>
    <docs.test-sources>${docs.contents}/test-sources</docs.test-sources>
    <docs.images>${project.build.outputDirectory}/images</docs.images>
    <docs.tools>${project.build.directory}/tools</docs.tools>
    <docs.resources>${docs.tools}/main/resources</docs.resources>
    <neo4j.version>${project.version}</neo4j.version>
    <doctools.version>29</doctools.version>
    <attach-docs-phase>none</attach-docs-phase>
    <licensing.phase>none</licensing.phase>
  </properties>

  <modules>
    <module>javadocs</module>
    <module>refcard</module>
    <module>contents</module>
  </modules>

  <scm>
    <connection>scm:git:git://github.com/neo4j/neo4j.git</connection>
    <developerConnection>scm:git:git@github.com:neo4j/neo4j.git</developerConnection>
	<url>https://github.com/neo4j/neo4j/tree/master/manual</url>
  </scm>

  <licenses>
    <license>
      <name>Creative Commons Attribution-ShareAlike 3.0 Unported</name>
      <url>http://creativecommons.org/licenses/by-sa/3.0/</url>
    </license>
  </licenses>

  <dependencies>
    <dependency>
      <groupId>org.neo4j.doc</groupId>
      <artifactId>neo4j-manual-contents</artifactId>
      <version>${neo4j.version}</version>
      <classifier>docs</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j.doc</groupId>
      <artifactId>neo4j-javadocs</artifactId>
      <version>${neo4j.version}</version>
      <classifier>javadoc</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j.doc</groupId>
      <artifactId>neo4j-cypher-refcard</artifactId>
      <version>${neo4j.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j.build.plugins</groupId>
      <artifactId>neo4j-doctools</artifactId>
      <version>${doctools.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/src</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>copy-csv-to-target</id>
            <phase>compile</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/docbkx/webhelp/csv</outputDirectory>
              <resources>
                <resource>
                  <directory>${docs.sources}/neo4j-cypher-docs-docs-jar/graphgists</directory>
                  <filtering>false</filtering>
                  <includes>
                    <include>**/*.csv</include>
                  </includes>
                </resource>
                <resource>
                  <directory>${docs.sources}/neo4j-cypher-docs-docs-jar/dev/ql/load-csv/csv-files</directory>
                  <filtering>false</filtering>
                  <includes>
                    <include>**/*.csv</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-doctools</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <type>jar</type>
              <includeArtifactIds>neo4j-doctools</includeArtifactIds>
              <outputDirectory>${docs.tools}</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>unpack-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <classifier>docs</classifier>
              <includeClassifiers>docs</includeClassifiers>
              <excludeTransitive>true</excludeTransitive>
              <useSubDirectoryPerArtifact>false</useSubDirectoryPerArtifact>
              <stripVersion>true</stripVersion>
              <excludes>META-INF,META-INF/**</excludes>
              <type>jar</type>
              <outputDirectory>${docs.contents}</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>unpack-javadoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <classifier>javadoc</classifier>
              <includeClassifiers>javadoc</includeClassifiers>
              <excludeTransitive>true</excludeTransitive>
              <useSubDirectoryPerArtifact>false</useSubDirectoryPerArtifact>
              <stripVersion>true</stripVersion>
              <excludes>META-INF,META-INF/**</excludes>
              <type>jar</type>
              <outputDirectory>${docs.javadocs}</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>unpack-refcard</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>neo4j-cypher-refcard</includeArtifactIds>
              <excludeTransitive>true</excludeTransitive>
              <useSubDirectoryPerArtifact>false</useSubDirectoryPerArtifact>
              <stripVersion>true</stripVersion>
              <excludes>META-INF,META-INF/**</excludes>
              <type>jar</type>
              <outputDirectory>${docs.refcard}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>execute-asciidoc</id>
            <phase>compile</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>make</executable>
              <arguments>
                <argument>webhelp_dist</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>execute-asciidoc-for-upgrades</id>
            <phase>compile</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>${docs.tools}/bin/asciidoc/asciidoc.py</executable>
              <arguments>
                <argument>--backend=docbook</argument>
                <argument>--attribute=neo4j-version=${project.version}</argument>
                <argument>--out-file=${project.build.directory}/upgrade/upgrades.xml</argument>
                <argument>${docs.sources}/neo4j-docs-jar/ops/upgrades.asciidoc</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>validate-xml</id>
            <phase>verify</phase>
            <goals><goal>java</goal></goals>
            <configuration>
              <mainClass>org.neo4j.doc.docbook.Validate</mainClass>
              <includePluginDependencies>true</includePluginDependencies>
              <includeProjectDependencies>false</includeProjectDependencies>
              <arguments>
                <argument>file://${docs.resources}/docbook-schema/docbook.xsd</argument>
                <argument>file://${project.build.directory}/neo4j-manual-html.xml</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.neo4j.build.plugins</groupId>
            <artifactId>neo4j-doctools</artifactId>
            <version>${doctools.version}</version>
            <exclusions>
              <exclusion>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
              </exclusion>
              <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-jdk14</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
          <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.7</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>create-upgrade-dir</id>
            <phase>process-resources</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <properties>
                <upgradeDir>${project.build.directory}/upgrade</upgradeDir>
              </properties>
              <source>
                new File( project.properties.upgradeDir ).mkdirs()
              </source>
            </configuration>
          </execution>
          <execution>
            <id>transform-upgrade-html-to-text</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <properties>
                <upgradehtmlLocation>file://${project.build.directory}/docbkx/html/upgrade/upgrades.html</upgradehtmlLocation>
                <outputFile>${project.build.directory}/upgrade/UPGRADE.txt</outputFile>
              </properties>
              <source>
                import net.htmlparser.jericho.Source
                import net.htmlparser.jericho.Renderer
                Source source = new Source( new URL( project.properties.upgradehtmlLocation ) )
                Renderer renderer = source.getRenderer().setMaxLineLength( 80 ).setConvertNonBreakingSpaces( true )
                new File( project.properties.outputFile ).write( renderer.toString(), 'UTF-8' )
              </source>
            </configuration>
          </execution>
          <execution>
            <id>setup-logging</id>
            <!-- A bug in the exec-maven-plugin used elsewhere in the build screws up the logging config,
            which leaks into the PDF rendering making it super slow. The code below resets the logging
            config, and the PDF rendering then works just fine. -->
            <phase>process-resources</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <source>
                import java.util.logging.*
                import java.nio.charset.*

                String config = "handlers= java.util.logging.ConsoleHandler"
                InputStream stream = new ByteArrayInputStream(config.getBytes(StandardCharsets.UTF_8));
                LogManager.getLogManager().readConfiguration(stream)
              </source>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>it.unimi.di.law</groupId>
            <artifactId>jericho-html-dev</artifactId>
            <version>20131217</version>
          </dependency>
          <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.3</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>com.agilejava.docbkx</groupId>
        <artifactId>docbkx-maven-plugin</artifactId>
        <version>2.0.15</version>
        <executions>
          <execution>
            <id>generate-manpages</id>
            <phase>process-classes</phase>
            <goals>
              <goal>generate-manpages</goal>
            </goals>
            <configuration>
              <sourceDirectory>${project.build.directory}/manpages</sourceDirectory>
            <postProcess>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j.1" destfile="${project.build.directory}/manpages/neo4j.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-shell.1" destfile="${project.build.directory}/manpages/neo4j-shell.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-installer.1" destfile="${project.build.directory}/manpages/neo4j-installer.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-backup.1" destfile="${project.build.directory}/manpages/neo4j-backup.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-arbiter.1" destfile="${project.build.directory}/manpages/neo4j-arbiter.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-coordinator.1" destfile="${project.build.directory}/manpages/neo4j-coordinator.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-coordinator-shell.1" destfile="${project.build.directory}/manpages/neo4j-coordinator-shell.1.gz"/>
              <gzip src="${project.build.directory}/docbkx/manpages/man1/neo4j-import.1" destfile="${project.build.directory}/manpages/neo4j-import.1.gz"/>
            </postProcess>
            </configuration>
          </execution>
          <execution>
            <id>generate-webhelp-html</id>
            <phase>process-classes</phase>
            <goals>
              <goal>generate-webhelp</goal>
            </goals>
            <configuration>
              <includes>neo4j-manual-html.xml</includes>
              <webhelpCustomization>${docs.resources}/conf/webhelp.xsl</webhelpCustomization>
              <admonGraphicsPath>images/icons/admon/</admonGraphicsPath>
              <generateLegalnoticeLink>true</generateLegalnoticeLink>
              <useIdAsFilename>true</useIdAsFilename>
              <generateToc>
                article toc,title
                book toc,title
                chapter toc,title
                part toc,title
                preface
                toc,title
                qandadiv toc
                qandaset toc
                reference toc,title
                sect1 toc
                sect2 toc
                sect3 toc
                sect4 toc
                sect5 toc
                section toc
                set toc,title
              </generateToc>
              <preProcess>
                <move todir="${project.build.directory}" overwrite="true">
                  <fileset dir="${project.build.directory}/manpages">
                    <include name="*.xml"/>
                  </fileset>
                </move>
              </preProcess>
              <postProcess>
                <copy todir="${project.build.directory}/docbkx/webhelp/images" overwrite="true">
                  <fileset dir="${docs.resources}/images"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/images" overwrite="true">
                  <fileset dir="${docs.contents}/src/images"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/css" overwrite="true">
                  <fileset dir="${docs.resources}/css"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/common" overwrite="true">
                  <fileset dir="${docs.resources}/common"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/js" overwrite="true">
                  <fileset dir="${docs.resources}/js"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/js" overwrite="true">
                  <fileset dir="${docs.contents}/js"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/javadocs" overwrite="true">
                  <fileset dir="${docs.javadocs}"/>
                </copy>
                <copy todir="${project.build.directory}/docbkx/webhelp/cypher-refcard" overwrite="true">
                  <fileset dir="${docs.refcard}"/>
                </copy>
                <!-- source code used by the manual.
                <copy todir="${project.build.directory}/docbkx/webhelp/code" overwrite="true">
                  <fileset dir="${docs.sourcecode}/neo4j-examples-sources-jar" />
                  <fileset dir="${docs.sourcecode}/neo4j-server-examples-sources-jar" />
                  <fileset dir="${docs.test-sources}/neo4j-backup-test-sources-jar" />
                  <fileset dir="${docs.test-sources}/neo4j-cypher-docs-test-sources-jar" />
                  <fileset dir="${docs.test-sources}/neo4j-examples-test-sources-jar" />
                  <fileset dir="${docs.test-sources}/neo4j-kernel-test-sources-jar" />
                  <fileset dir="${docs.test-sources}/neo4j-lucene-index-test-sources-jar" />
                  <fileset dir="${docs.test-sources}/neo4j-server-test-sources-jar" />
                </copy>
                 -->
              </postProcess>
            </configuration>
          </execution>
          <execution>
            <id>generate-upgrade-html</id>
            <phase>process-classes</phase>
            <goals>
              <goal>generate-html</goal>
            </goals>
            <configuration>
              <includes>upgrade/upgrades.xml</includes>
              <calloutGraphics>false</calloutGraphics>
              <navigGraphics>false</navigGraphics>
              <admonTextlabel>true</admonTextlabel>
              <admonGraphics>false</admonGraphics>
              <htmlCustomization>${docs.resources}/conf/text.xsl</htmlCustomization>
              <preProcess>
                <replace file="${project.build.directory}/upgrade/upgrades.xml" encoding="UTF-8" token="&amp;#8594;" value="--&gt;" />
              </preProcess>
            </configuration>
          </execution>
          <execution>
            <id>generate-pdf</id>
            <phase>process-classes</phase>
            <goals>
              <goal>generate-pdf</goal>
            </goals>
            <configuration>
              <includes>neo4j-manual-shortinfo.xml</includes>
              <foCustomization>${docs.resources}/conf/fo.xsl</foCustomization>
              <externalFOPConfiguration>${docs.resources}/conf/fop.xml</externalFOPConfiguration>
              <generateToc>
                book toc
                part toc
              </generateToc>
              <preProcess>
                <copy todir="${project.build.directory}/images" overwrite="true">
                  <fileset dir="${docs.resources}/images"/>
                </copy>
                <copy todir="${project.build.directory}/images" overwrite="true">
                  <fileset dir="${docs.contents}/src/images"/>
                </copy>
                <replace file="${project.build.directory}/neo4j-manual-shortinfo.xml" encoding="UTF-8" token="url=&quot;javadocs" value="url=&quot;http://neo4j.com/docs/${project.version}/javadocs" />
                <replace file="${project.build.directory}/neo4j-manual-shortinfo.xml" encoding="UTF-8" token="url=&quot;cypher-refcard" value="url=&quot;http://neo4j.com/docs/${project.version}/cypher-refcard" />
              </preProcess>
              <admonGraphicsPath>${docs.resources}/images/icons/admon/</admonGraphicsPath>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <xincludeSupported>true</xincludeSupported>
          <glossarySort>true</glossarySort>
          <tocMaxDepth>2</tocMaxDepth>
          <generateSectionTocLevel>1</generateSectionTocLevel>
          <admonGraphics>true</admonGraphics>
          <admonGraphicsExtension>.svg</admonGraphicsExtension>
          <htmlExt>.html</htmlExt>
          <chunkerOutputOmitXmlDeclaration>yes</chunkerOutputOmitXmlDeclaration>
          <chunkSectionDepth>1</chunkSectionDepth>
          <chapterAutolabel>1</chapterAutolabel>
          <sectionAutolabel>1</sectionAutolabel>
          <sectionAutolabelMaxDepth>1</sectionAutolabelMaxDepth>
          <appendixAutolabel>true</appendixAutolabel>
          <sourceDirectory>${project.build.directory}</sourceDirectory>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.neo4j.build.plugins</groupId>
            <artifactId>neo4j-docbook-xml</artifactId>
            <version>4.5</version>
          </dependency>
          <dependency>
            <groupId>org.neo4j.build.plugins</groupId>
            <artifactId>webhelp-xhtml5-xsl</artifactId>
            <version>1.78.1</version>
            <type>zip</type>
            <classifier>ns-resources</classifier>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.neo4j.build.plugins</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>src/main/resources/js/**</exclude>
            <exclude>src/main/resources/css/**</exclude>
            <exclude>src/bin/asciidoc/**</exclude>
            <exclude>src/js/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-docs</id>
            <phase>none</phase>
          </execution>
          <execution>
            <id>attach-test-jar</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <tag>${releaseVersion}</tag>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>manpages</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assemblies/manpages.xml</descriptor>
              </descriptors>
              <finalName>${project.artifactId}-${project.version}</finalName>
              <appendAssemblyId>true</appendAssemblyId>
              <attach>true</attach>
            </configuration>
          </execution>
          <execution>
            <id>manpagesenterprise</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assemblies/manpages-enterprise.xml</descriptor>
              </descriptors>
              <finalName>${project.artifactId}-${project.version}</finalName>
              <appendAssemblyId>true</appendAssemblyId>
              <attach>true</attach>
            </configuration>
          </execution>
          <execution>
            <id>upgrade</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assemblies/upgrade.xml</descriptor>
              </descriptors>
              <finalName>${project.artifactId}-${project.version}</finalName>
              <appendAssemblyId>true</appendAssemblyId>
              <attach>true</attach>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>debug-asciidoc</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <property>
          <name>debug</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>execute-asciidoc</id>
                <phase>compile</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>make</executable>
                  <arguments>
                    <argument>webhelp_dist</argument>
                    <argument>KEEP=1</argument>
                    <argument>VERBOSE=1</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>publish-manual</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <property>
          <name>publish-manual</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>upload-to-servers</id>
                <phase>deploy</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>${project.build.directory}/../src/build/upload.sh</executable>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

	<repositories>
		<repository>
		<id>neo4j-release-repository</id>
		<name>Neo4j Maven 2 release repository</name>
		<url>http://m2.neo4j.org/content/repositories/releases</url>
		<releases>
			<enabled>true</enabled>
		</releases>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
		</repository>
	</repositories>
</project>

