<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <artifactId>keycloak-docs-parent</artifactId>
        <groupId>org.keycloak</groupId>
        <version>26.0.15.redhat-00001</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <name>Keycloak Documentation Parent</name>
    <groupId>org.keycloak.documentation</groupId>
    <artifactId>documentation-parent</artifactId>
    <version>26.0.15.redhat-00001</version>
    <packaging>pom</packaging>

    <properties>
        <masterFile>index</masterFile>
        <imagesDir>keycloak-images</imagesDir>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.plugin.assembly>3.0.0</version.plugin.assembly>
        <version.plugin.resources>3.0.2</version.plugin.resources>
        <version.plugin.dependency>3.0.1</version.plugin.dependency>
        <version.plugin.antrun>1.8</version.plugin.antrun>
        <version.compiler.plugin>3.6.1</version.compiler.plugin>
        <version.jar.plugin>3.0.2</version.jar.plugin>
        <version.install.plugin>2.5.2</version.install.plugin>
        <version.surefire.plugin>2.22.2</version.surefire.plugin>
        <version.plexus.utils>4.0.0.redhat-00002</version.plexus.utils>
    </properties>

    <modules>
        <module>header-maven-plugin</module>
        <module>api_documentation</module>
        <module>authorization_services</module>
        <module>server_admin</module>
        <module>server_development</module>
        <module>release_notes</module>
        <module>upgrading</module>
        <module>aggregation</module>
        <module>dist</module>
  </modules>

    <profiles>
        <profile>
            <id>tests</id>
            <activation>
                <property>
                    <name>!skipProjectTests</name>
                </property>
            </activation>
            <modules>
                <module>tests</module>
            </modules>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.jar.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${version.install.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${version.plugin.antrun}</version>
                    <executions>
                        <execution>
                            <id>echo-output</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                            <configuration>
                                <target>
                                    <!-- print the link on the console to be able to open it in the local browser -->
                                    <echo>OUTPUT: file://${project.build.directory}/generated-docs/${masterFile}.html ${projectLatestBuild}</echo>
                                </target>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${version.plugin.dependency}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.surefire.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.keycloak.documentation</groupId>
                    <artifactId>header-maven-plugin</artifactId>
                    <version>26.0.15.redhat-00001</version>
                    <executions>
                        <execution>
                            <id>add-file-headers</id>
                            <goals>
                                <goal>header</goal>
                            </goals>
                            <configuration>
                                <masterFileName>${masterFile}</masterFileName>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.asciidoctor</groupId>
                    <artifactId>asciidoctor-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>asciidoc-to-html</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>process-asciidoc</goal>
                            </goals>
                            <configuration>
                                <sourceDirectory>${basedir}/target/sources</sourceDirectory>
                                <sourceDocumentName>${masterFile}.adoc</sourceDocumentName>
                                <backend>html5</backend>
                                <attributes>
                                    <source-highlighter>coderay</source-highlighter>
                                    <imagesdir>./</imagesdir>
                                    <toc>left</toc>
                                    <toc>left</toc>
                                    <icons>font</icons>
                                    <sectanchors>true</sectanchors>
                                    <idprefix />
                                    <idseparator>-</idseparator>
                                    <docinfo1>true</docinfo1>
                                    <masterFile>${masterFile}</masterFile>
                                </attributes>
                                <resources>
                                    <resource>
                                        <directory>${project.basedir}</directory>
                                        <includes>
                                            <include>images/**/*.png</include>
                                            <include>${imagesDir}/**/*.png</include>
                                        </includes>
                                    </resource>
                                </resources>
                                <logHandler>
                                    <failIf>
                                        <severity>WARN</severity>
                                    </failIf>
                                </logHandler>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${version.plugin.resources}</version>
                    <executions>
                        <execution>
                            <id>asciidoc-copy-resources</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <resources>
                                </resources>
                                <outputDirectory>target/generated-docs</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${version.plugin.assembly}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
