<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source
  ~ Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual contributors
  ~ by the @authors tag. See the copyright.txt in the distribution for a
  ~ full listing of individual contributors.
  ~
  ~ Licensed 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>
        <artifactId>hibernate-validator-parent</artifactId>
        <groupId>org.hibernate</groupId>
        <version>5.1.0.Final</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

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

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

    <properties>
        <jdocbookSourceDirectory>${basedir}/src/main/docbook</jdocbookSourceDirectory>
        <jdocbook.ignoreTranslations>false</jdocbook.ignoreTranslations>
        <!-- Skip artifact deployment -->
        <maven.deploy.skip>true</maven.deploy.skip>
    </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>
            <!--
            Explicitly configuring executions of the compiler, surefire and resource
            plug-ins (which are disabled due to the jdocbook packaging) in order to
            compile and test the examples used in the reference guide
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-testResources</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testResources</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jboss.maven.plugins</groupId>
                <artifactId>maven-jdocbook-plugin</artifactId>
                <configuration>
                    <sourceDirectory>${jdocbookSourceDirectory}</sourceDirectory>
                    <sourceDocumentName>master.xml</sourceDocumentName>
                    <masterTranslation>en-US</masterTranslation>
                    <translations>
                        <translation>zh-CN</translation>
                    </translations>
                    <!--
                    The jdookbook plug-in doesn't define an expression for this property, therefore
                    it can't be passed on the command line. To address this issue the value is retrieved
                    from a custom property, which itself can be set using -DignoreTranslations=...
                    -->
                    <ignoreTranslations>${jdocbook.ignoreTranslations}</ignoreTranslations>
                    <imageResource>
                        <directory>${basedir}/src/main/docbook/en-US/images</directory>
                    </imageResource>
                    <formats>
                        <format>
                            <formatName>pdf</formatName>
                            <stylesheetResource>classpath:/xslt/org/hibernate/jdocbook/xslt/pdf.xsl
                            </stylesheetResource>
                            <finalName>hibernate_validator_reference.pdf</finalName>
                        </format>
                        <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>
                    </formats>
                    <options>
                        <xincludeSupported>true</xincludeSupported>
                        <xmlTransformerType>saxon</xmlTransformerType>
                        <docbookVersion>1.72.0</docbookVersion>
                        <localeSeparator>-</localeSeparator>
                        <injectionDateFormat>yyyy-MM-dd</injectionDateFormat>
                    </options>
                    <injections>
                        <injection>
                            <name>bvVersion</name>
                            <value>${bv.api.version}</value>
                        </injection>
                    </injections>
                    <profiling>
                        <enabled>true</enabled>
                    </profiling>
                </configuration>
                <executions>
                    <execution>
                        <!--
                            here we are attaching the translate goal so that the translations are processed
                            before compilation so that the translated XML is also transformed during
                            generation
                        -->
                        <phase>process-resources</phase>
                        <goals>
                            <goal>translate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                println "[INFO] ------------------------------------------------------------------------";
                                println "[INFO] DOCUMENTATION BUILD INFO                                                ";
                                println "[INFO] ------------------------------------------------------------------------";
                                println "[INFO] The documentation build requires the external tool po2xml for processing";
                                println "[INFO] translations. You can skip the whole documentation build via specifying ";
                                println "[INFO] the property 'disableDocumentationBuild':                               ";
                                println "[INFO]                                                                         ";
                                println "[INFO] mvn install -DdisableDocumentationBuild=true                            ";
                                println "[INFO]                                                                         ";
                                println "[INFO] Or you can just skip the translations:                                  ";
                                println "[INFO]                                                                         ";
                                println "[INFO] mvn install -Djdocbook.ignoreTranslations=true                          ";
                                println "[INFO]                                                                         ";
                                println "[INFO] See http://community.jboss.org/wiki/ContributingtoHibernateValidator    ";
                                println "[INFO] ------------------------------------------------------------------------";
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.zanata</groupId>
                <artifactId>zanata-maven-plugin</artifactId>
                <configuration>
                    <srcDir>${basedir}/src/main/docbook</srcDir>
                    <srcDirPot>${basedir}/src/main/docbook/pot</srcDirPot>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
