<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Hibernate Validator, declare and validate application constraints
  ~
  ~ License: Apache License, Version 2.0
  ~ See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
  -->
<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>
        <artifactId>hibernate-validator-parent</artifactId>
        <groupId>org.hibernate</groupId>
        <version>5.3.6.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>hibernate-validator-documentation</artifactId>
    <packaging>jar</packaging>

    <name>Hibernate Validator Manual</name>
    <description>The Hibernate Validator reference manual</description>

    <properties>
        <jdocbook.ignoreTranslations>false</jdocbook.ignoreTranslations>
        <!-- Skip artifact deployment -->
        <maven.deploy.skip>true</maven.deploy.skip>
        <maven-surefire-plugin.argLine>-Duser.language=en</maven-surefire-plugin.argLine>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>javax.el</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator-cdi</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!--
                     The default target level is 1.6 (configured in parent pom).
                     We only have test sources in this module which use 1.8 (also configured explicitly via 'testSource'
                     and 'testTarget' in the parent pom). Unfortunately, this causes problems when importing in an IDE
                     (since they don't handle the different language level settings between production and test classes).
                     The import would generate a module with a target level of 1.6 which leads to compilation errors
                     in the IDE. Since we have no production classes in this module we can just set 'source' and 'target'
                     to 1.8 as well, so that the IDE import works. See HV-915
                     -->
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html</backend>
                            <outputDirectory>${basedir}/target/asciidoc-html</outputDirectory>
                            <sourceHighlighter>highlightjs</sourceHighlighter>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>1.7.26</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-resources-plugin</artifactId>
              <executions>
                <execution>
                  <id>copy-asciidoc-images</id>
                  <phase>generate-resources</phase>
                  <goals>
                    <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${basedir}/target/asciidoc-html/images</outputDirectory>
                    <resources>
                      <resource>
                        <directory>${basedir}/src/main/asciidoc/images</directory>
                      </resource>
                    </resources>
                  </configuration>
                </execution>
              </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>docbook</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctor-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>output-docbook</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>process-asciidoc</goal>
                                </goals>
                                <configuration>
                                    <backend>docbook</backend>
                                    <outputDirectory>target/asciidoc-docbook/en-US</outputDirectory>
                                    <attributes>
                                        <sourcedir>${basedir}/src/test/java</sourcedir>
                                        <engine-sourcedir>${basedir}/../engine/src/main/java</engine-sourcedir>
                                    </attributes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-docbook-images-to-staging</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${basedir}/target/docbook/staging/images/images</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/main/asciidoc/images</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jboss.maven.plugins</groupId>
                        <artifactId>maven-jdocbook-plugin</artifactId>
                        <configuration>
                            <sourceDirectory>${basedir}/target/asciidoc-docbook</sourceDirectory>
                            <sourceDocumentName>index.xml</sourceDocumentName>
                            <masterTranslation>en-US</masterTranslation>
                            <formats>
                                <format>
                                    <formatName>html_single</formatName>
                                    <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl
                                    </stylesheetResource>
                                    <finalName>index.html</finalName>
                                </format>
                                <format>
                                    <formatName>html</formatName>
                                    <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl
                                    </stylesheetResource>
                                    <finalName>index.html</finalName>
                                </format>
                                <format>
                                    <formatName>pdf</formatName>
                                    <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl
                                    </stylesheetResource>
                                    <finalName>hibernate_validator_reference.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 -->
                                <localeSeparator>-</localeSeparator>
                                <injectionDateFormat>yyyy-MM-dd</injectionDateFormat>
                                <transformerParameters>
                                    <html.googleAnalyticsId>UA-45270411-3</html.googleAnalyticsId>
                                    <html.googleTagManagerId>GTM-NJWS5L</html.googleTagManagerId>
                                    <html.googleTagManagerChannel>Hibernate</html.googleTagManagerChannel>
                                </transformerParameters>
                            </options>
                        </configuration>
                        <executions>
                            <execution>
                                <id>docbook-processing</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>resources</goal>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
