<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>

    <groupId>org.hibernate.infra</groupId>
    <artifactId>hibernate-asciidoctor-theme</artifactId>
    <packaging>pom</packaging>
    <version>6.1.1.Final</version>

    <name>Hibernate Asciidoctor theme</name>
    <description>
        The Asciidoctor theme used for the reference documentations of the Hibernate projects.
    </description>
    <url>https://hibernate.org</url>

    <organization>
        <name>Hibernate</name>
        <url>https://www.hibernate.org</url>
    </organization>

    <developers>
        <developer>
            <id>guillaume.smet</id>
            <name>Guillaume Smet</name>
            <email>guillaume@hibernate.org</email>
            <url>https://in.relation.to/guillaume-smet/</url>
        </developer>
        <developer>
            <id>yoann.rodiere</id>
            <name>Yoann Rodière</name>
            <email>yoann@hibernate.org</email>
            <organization>Red Hat, Inc.</organization>
            <url>https://in.relation.to/yoann-rodiere/</url>
        </developer>
    </developers>

    <properties>
        <resources.dir>${project.basedir}/src/main/resources</resources.dir>
        <zip-content.dir>${resources.dir}</zip-content.dir>
        <asciidoc.theme.dir>${resources.dir}/asciidoc</asciidoc.theme.dir>

        <jdk.min.version>17</jdk.min.version>
        <maven.min.version>3.9.11</maven.min.version>
        <!-- Run mvn wrapper:wrapper when updating the wrapper plugin version -->
        <maven-wrapper-plugin.version>3.3.4</maven-wrapper-plugin.version>

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
        <maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
        <version.enforcer.plugin>3.6.1</version.enforcer.plugin>
        <asciidoctor-maven-plugin.version>3.2.0</asciidoctor-maven-plugin.version>
        <asciidoctorj.version>3.0.0</asciidoctorj.version>
        <asciidoctorj-pdf.version>2.3.19</asciidoctorj-pdf.version>

        <!-- We always publish to a local directory, JReleaser is supposed to take care of publishing to Nexus: -->
        <local.staging.releases.repo.id>staging-deploy</local.staging.releases.repo.id>
        <local.staging.releases.repo.url>file:${maven.multiModuleProjectDirectory}/target/staging-deploy/maven</local.staging.releases.repo.url>
        <central.snapshots.repo.id>central-snapshots</central.snapshots.repo.id>
        <central.snapshots.repo.url>https://central.sonatype.com/repository/maven-snapshots/</central.snapshots.repo.url>

    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-wrapper-plugin</artifactId>
                <version>${maven-wrapper-plugin.version}</version>
                <configuration>
                    <mavenVersion>${maven.min.version}</mavenVersion>
                    <distributionType>bin</distributionType>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
                <executions>
                    <!-- Only for testing -->
                    <execution>
                        <id>copy-images-to-test-directory</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${asciidoc.theme.dir}/images/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoctor/images</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-css-to-test-directory</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${asciidoc.theme.dir}/css/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoctor/css</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-script-to-test-directory</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${asciidoc.theme.dir}/script/</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/asciidoctor/script</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${maven-assembly-plugin.version}</version>
                <configuration>
                    <descriptors>
                        <descriptor>${basedir}/src/main/assembly/zip-content.xml</descriptor>
                    </descriptors>
                    <finalName>${project.artifactId}-${project.version}</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>test</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <attributes>
                                <docinfodir>${project.basedir}/src/main/resources/asciidoc/docinfo/hibernate</docinfodir>
                                <imagesdir>images/</imagesdir>
                                <stylesdir>css</stylesdir>
                            </attributes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>output-pdf</id>
                        <phase>test</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>pdf</backend>
                            <attributes>
                                <pdf-themesdir>${asciidoc.theme.dir}/theme</pdf-themesdir>
                                <pdf-theme>hibernate</pdf-theme>
                                <pdf-fontsdir>${asciidoc.theme.dir}/theme/fonts;GEM_FONTS_DIR</pdf-fontsdir>
                                <pagenums />
                                <idprefix />
                                <idseparator>-</idseparator>
                                <imagesdir>${asciidoc.theme.dir}/images/</imagesdir>
                            </attributes>
                            <enableVerbose>true</enableVerbose>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>src/test/asciidoc</sourceDirectory>
                    <sourceDocumentName>index.asciidoc</sourceDocumentName>
                    <outputDirectory>${project.build.directory}/asciidoctor</outputDirectory>
                    <attributes>
                        <icons>font</icons>
                        <tabsize>4</tabsize>
                        <docinfodir>${asciidoc.theme.dir}/docinfo/noorm-documentation</docinfodir>

                        <sourcedir>${basedir}/src/test/java</sourcedir>
                        <theme-version>${project.version}</theme-version>
                    </attributes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj</artifactId>
                        <version>${asciidoctorj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.asciidoctor</groupId>
                        <artifactId>asciidoctorj-pdf</artifactId>
                        <version>${asciidoctorj-pdf.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${version.enforcer.plugin}</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[${jdk.min.version},)</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>${maven.min.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <attach>true</attach>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <attach>true</attach>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <defaultGoal>deploy</defaultGoal>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <repository>
            <id>${local.staging.releases.repo.id}</id>
            <name>Local Staging Directory Releases Repository</name>
            <url>${local.staging.releases.repo.url}</url>
        </repository>
        <snapshotRepository>
            <id>${central.snapshots.repo.id}</id>
            <name>Maven Central Snapshots Repository</name>
            <url>${central.snapshots.repo.url}</url>
        </snapshotRepository>
    </distributionManagement>

    <inceptionYear>2017</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/hibernate/hibernate-asciidoctor-theme.git</connection>
        <developerConnection>scm:git:git@github.com:hibernate/hibernate-asciidoctor-theme.git</developerConnection>
        <url>https://github.com/hibernate/hibernate-asciidoctor-theme</url>
        <tag>HEAD</tag>
    </scm>

    <ciManagement>
        <system>Jenkins</system>
        <url>https://ci.hibernate.org/</url>
    </ciManagement>
</project>
