<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2019 Contributors to the Eclipse Foundation.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-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">
    <parent>
        <groupId>jakarta.management.j2ee</groupId>
        <artifactId>management-api-parent</artifactId>
        <version>1.1.4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>management-spec</artifactId>
    <packaging>pom</packaging>
    <name>Jakarta Management Specification</name>

    <properties>
        <site.output.dir>${project.build.directory}/staging</site.output.dir>
        <maven.site.skip>true</maven.site.skip>
        <asciidoctor.maven.plugin.version>1.5.7.1</asciidoctor.maven.plugin.version>
        <asciidoctorj.version>1.6.2</asciidoctorj.version>
        <asciidoctorj.pdf.version>1.5.0-alpha.16</asciidoctorj.pdf.version>
        <jruby.version>9.2.6.0</jruby.version>
        <!-- status: DRAFT, BETA, etc., or blank for final -->
        <status>DRAFT</status>
        <maven.build.timestamp.format>MMMM dd, yyyy</maven.build.timestamp.format>
        <revisiondate>${maven.build.timestamp}</revisiondate>
    </properties>

    <build>
        <defaultGoal>package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[1.8.0,1.9.0)</version>
                                    <message>You need JDK8 or lower</message>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>${jruby.version}</version>
                    </dependency>
                    <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>
                <executions>
                    <execution>
                        <id>asciidoc-to-html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                            <outputFile>${project.build.directory}/generated-docs/management-spec-${spec.version}.html</outputFile>
                            <attributes>
                                <doctype>book</doctype>
                                <status>${status}</status>
                                <data-uri />
                                <icons>font</icons>
                                <toc>left</toc>
                                <icons>font</icons>
                                <sectanchors>true</sectanchors>
                                <idprefix />
                                <idseparator>-</idseparator>
                                <docinfo1>true</docinfo1>
                            </attributes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>asciidoc-to-pdf</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>pdf</backend>
                            <outputFile>${project.build.directory}/generated-docs/management-spec-${spec.version}.pdf</outputFile>
                            <attributes>
                                <pdf-stylesdir>${project.basedir}/src/main/theme</pdf-stylesdir>
                                <pdf-style>jakartaee</pdf-style>
                                <doctype>book</doctype>
                                <status>${status}</status>
                                <data-uri />
                                <icons>font</icons>
                                <pagenums />
                                <toc />
                                <icons>font</icons>
                                <sectanchors>true</sectanchors>
                                <idprefix />
                                <idseparator>-</idseparator>
                                <docinfo1>true</docinfo1>
                                <embedAssets>true</embedAssets>
                            </attributes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <sourceDocumentName>management-spec.adoc</sourceDocumentName>
                    <sourceHighlighter>coderay</sourceHighlighter>
                    <attributes>
                        <revnumber>${spec.version}</revnumber>
                        <revremark>${status}</revremark>
                        <revdate>${revisiondate}</revdate>
                    </attributes>
                </configuration>

            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                    <useReleaseProfile>false</useReleaseProfile>
                    <arguments>${release.arguments}</arguments>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9.4</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!--
                This is the rule that builds the zip file for download.
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.1</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
