<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>ch.sbb.polarion.extensions</groupId>
        <artifactId>ch.sbb.polarion.extension.generic</artifactId>
        <version>14.1.6</version>
    </parent>

    <artifactId>ch.sbb.polarion.extension.docx-exporter</artifactId>
    <version>4.2.2</version>
    <packaging>jar</packaging>

    <name>Polarion ALM extension to convert Documents to DOCX files</name>
    <description>This Polarion extension provides possibility to convert Polarion Documents to DOCX files.</description>
    <url>https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.docx-exporter</url>

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

    <developers>
        <developer>
            <name>SBB Polarion Team</name>
            <email>polarion-opensource@sbb.ch</email>
            <organization>SBB AG</organization>
            <organizationUrl>https://www.sbb.ch</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.docx-exporter.git</connection>
        <developerConnection>scm:git:ssh://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.docx-exporter.git</developerConnection>
        <url>https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.docx-exporter/tree/main</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.docx-exporter/issues</url>
    </issueManagement>

    <properties>
        <pdfbox.version>3.0.7</pdfbox.version>
        <docx4j.version>11.5.14</docx4j.version>
        <jakarta.xml.bind.version>4.0.5</jakarta.xml.bind.version>
        <jakarta.activation.version>2.1.4</jakarta.activation.version>
        <okapi.xliff.version>1.48.0</okapi.xliff.version>
        <byte-buddy.version>1.18.10-jdk5</byte-buddy.version>

        <slf4j.version>2.0.18</slf4j.version>
        <testcontainers.version>2.0.5</testcontainers.version>
        <jackson.version>2.22.0</jackson.version>

        <exec-maven-plugin.version>3.3.0</exec-maven-plugin.version>
        <awaitility.version>4.3.0</awaitility.version>
        <tika.version>3.3.1</tika.version>
        <ph-css.version>8.2.1</ph-css.version>

        <maven-jar-plugin.Extension-Context>docx-exporter</maven-jar-plugin.Extension-Context>
        <maven-jar-plugin.Automatic-Module-Name>ch.sbb.polarion.extension.docx_exporter</maven-jar-plugin.Automatic-Module-Name>
        <maven-jar-plugin.Discover-Base-Package>ch.sbb.polarion.extension.docx_exporter</maven-jar-plugin.Discover-Base-Package>
        <maven-jar-plugin.Configuration-Properties-Prefix>ch.sbb.polarion.extension.docx-exporter.</maven-jar-plugin.Configuration-Properties-Prefix>
        <web.app.name>${maven-jar-plugin.Extension-Context}</web.app.name>

        <!-- Extension-specific Require-Bundle (in addition to common ones from parent POM):
            com.polarion.alm.wiki
            org.jsoup
            org.apache.tika.patched;resolution:=optional
            org.apache.tika;resolution:=optional
        -->
        <maven-jar-plugin.Require-Bundle.extension>com.polarion.alm.wiki,org.jsoup,org.apache.tika.patched;resolution:=optional,org.apache.tika;resolution:=optional</maven-jar-plugin.Require-Bundle.extension>
        <maven-jar-plugin.Require-Bundle>${maven-jar-plugin.Require-Bundle.common},${maven-jar-plugin.Require-Bundle.extension}</maven-jar-plugin.Require-Bundle>

        <!--suppress UnresolvedMavenProperty -->
        <markdown2html-maven-plugin.version>1.6.0</markdown2html-maven-plugin.version>
        <markdown2html-maven-plugin.failOnError>${env.MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR}</markdown2html-maven-plugin.failOnError>
        <markdown2html-maven-plugin.user-guide.inputFile>${project.basedir}/USER_GUIDE.md</markdown2html-maven-plugin.user-guide.inputFile>
        <markdown2html-maven-plugin.user-guide.outputFileName>user-guide.html</markdown2html-maven-plugin.user-guide.outputFileName>
        <markdown2html-maven-plugin.user-guide.outputFile>${markdown2html-maven-plugin.extensionContextAdminHtml}/${markdown2html-maven-plugin.user-guide.outputFileName}</markdown2html-maven-plugin.user-guide.outputFile>
        <markdown2html-maven-plugin.disclaimer.inputFile>${project.basedir}/DISCLAIMER.md</markdown2html-maven-plugin.disclaimer.inputFile>
        <markdown2html-maven-plugin.disclaimer.outputFileName>disclaimer.html</markdown2html-maven-plugin.disclaimer.outputFileName>
        <markdown2html-maven-plugin.disclaimer.outputFile>${markdown2html-maven-plugin.extensionContextAdminHtml}/${markdown2html-maven-plugin.disclaimer.outputFileName}</markdown2html-maven-plugin.disclaimer.outputFile>
        <swagger-maven-plugin.version>2.2.22</swagger-maven-plugin.version>

        <frontend-maven-plugin.version>2.0.0</frontend-maven-plugin.version>
        <frontend-maven-plugin.nodeVersion>v24.11.0</frontend-maven-plugin.nodeVersion>
        <frontend-maven-plugin.npmVersion>11.6.1</frontend-maven-plugin.npmVersion>

        <!--suppress UnresolvedMavenProperty -->
        <skipJavaScriptTests>${skipTests}</skipJavaScriptTests>

        <apache-poi.version>5.5.1</apache-poi.version>
    </properties>

    <profiles>
        <profile>
            <id>polarion2512</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <velocity-engine-core.artifactId>org.apache.velocity.engine-core_2.3.0</velocity-engine-core.artifactId>
                <org.jsoup.artifactId>org.jsoup_1.15.2</org.jsoup.artifactId>
            </properties>
        </profile>
        <profile>
            <id>tests-with-pandoc-docker</id>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <configuration>
                            <!-- hide unwanted exceptions logging -->
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                            <systemPropertyVariables>
                                <docxExporterImpl>docker</docxExporterImpl>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
                <version>1.28.0</version>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>ch.sbb.polarion.extensions</groupId>
            <artifactId>ch.sbb.polarion.extension.generic.app</artifactId>
            <version>${project.parent.version}</version>
        </dependency>

        <dependency>
            <groupId>com.polarion.thirdparty</groupId>
            <artifactId>${velocity-engine-core.artifactId}</artifactId>
            <version>${polarion.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.polarion.alm.wiki</groupId>
            <artifactId>sidecar</artifactId>
            <version>${polarion.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.polarion.thirdparty</groupId>
            <artifactId>${org.jsoup.artifactId}</artifactId>
            <version>${polarion.version}</version>
            <scope>provided</scope>
        </dependency>

        <!--  3rd-party libraries to be packaged into resulting jar  -->
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>${pdfbox.version}</version>
            <exclusions> <!-- pdfbox 3.0.0 has scope test for junit, pdfbox 3.0.1 has no such scope, that's why this exclusion has been added -->
                <exclusion>
                    <groupId>org.junit.jupiter</groupId>
                    <artifactId>junit-jupiter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>net.sf.okapi.lib</groupId>
            <artifactId>okapi-lib-xliff2</artifactId>
            <version>${okapi.xliff.version}</version>
        </dependency>
        <dependency>
            <groupId>net.bytebuddy</groupId>
            <artifactId>byte-buddy</artifactId>
            <version>${byte-buddy.version}</version>
        </dependency>

        <dependency>
            <groupId>org.docx4j</groupId>
            <artifactId>docx4j-core</artifactId>
            <version>${docx4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.docx4j</groupId>
            <artifactId>docx4j-export-fo</artifactId>
            <version>${docx4j.version}</version>
            <exclusions>
                <!-- conflicts with xliff2 so the latter stops working -->
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.docx4j</groupId>
            <artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
            <version>${docx4j.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>${jakarta.xml.bind.version}</version>
        </dependency>
        <dependency>
            <groupId>org.docx4j</groupId>
            <artifactId>docx4j-diffx</artifactId>
            <version>${docx4j.version}</version>
        </dependency>
        <dependency>
            <groupId>com.helger</groupId>
            <artifactId>ph-css</artifactId>
            <version>${ph-css.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>${tika.version}</version>
        </dependency>

        <!--  Test dependencies  -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.activation</groupId>
            <artifactId>jakarta.activation-api</artifactId>
            <version>${jakarta.activation.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${awaitility.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.sbb.polarion.extensions</groupId>
            <artifactId>ch.sbb.polarion.extension.generic.app</artifactId>
            <version>${project.parent.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>${apache-poi.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${markdown2html-maven-plugin.extensionContextAdminHtml}</directory>
                            <includes>
                                <include>${markdown2html-maven-plugin.disclaimer.outputFileName}</include>
                                <include>${markdown2html-maven-plugin.user-guide.outputFileName}</include>
                                <include>${markdown2html-maven-plugin.outputFileName}</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>ch.sbb.maven.plugins</groupId>
                <artifactId>markdown2html-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>readme.md-to-about.html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>convert</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>user_guide.md-to-user-guide.html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>convert</goal>
                        </goals>
                        <configuration>
                            <inputFile>USER_GUIDE.md</inputFile>
                            <outputFile>${markdown2html-maven-plugin.user-guide.outputFile}</outputFile>
                            <tokenEnvVarName>${markdown2html-maven-plugin.tokenEnvVarName}</tokenEnvVarName>
                            <failOnError>${markdown2html-maven-plugin.failOnError}</failOnError>
                            <generateHeadingIds>${markdown2html-maven-plugin.generateHeadingIds}</generateHeadingIds>
                            <relativeLinkPrefix>${project.scm.url}</relativeLinkPrefix>
                            <openExternalLinksInNewTab>true</openExternalLinksInNewTab>
                            <imageProcessingType>EMBED</imageProcessingType>
                        </configuration>
                    </execution>
                    <execution>
                        <id>disclaimer.md-to-disclaimer.html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>convert</goal>
                        </goals>
                        <configuration>
                            <inputFile>DISCLAIMER.md</inputFile>
                            <outputFile>${markdown2html-maven-plugin.disclaimer.outputFile}</outputFile>
                            <tokenEnvVarName>${markdown2html-maven-plugin.tokenEnvVarName}</tokenEnvVarName>
                            <failOnError>${markdown2html-maven-plugin.failOnError}</failOnError>
                            <generateHeadingIds>${markdown2html-maven-plugin.generateHeadingIds}</generateHeadingIds>
                            <relativeLinkPrefix>${project.scm.url}</relativeLinkPrefix>
                            <openExternalLinksInNewTab>true</openExternalLinksInNewTab>
                            <imageProcessingType>EMBED</imageProcessingType>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>ch.sbb.polarion.extensions</groupId>
                                    <artifactId>ch.sbb.polarion.extension.generic.app</artifactId>
                                    <version>${project.parent.version}</version>
                                    <outputDirectory>${project.build.directory}/generic-jar-content</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <configuration>
                    <outputFormat>JSON</outputFormat>
                    <resourcePackages>
                        <package>ch.sbb.polarion.extension.generic.rest.controller.info</package>
                        <package>ch.sbb.polarion.extension.generic.rest.controller.settings</package>
                        <package>ch.sbb.polarion.extension.generic.rest.model</package>
                        <package>ch.sbb.polarion.extension.docx_exporter.rest.controller</package>
                        <package>ch.sbb.polarion.extension.docx_exporter.rest.model</package>
                    </resourcePackages>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.github.grigoriev</groupId>
                <artifactId>pre-commit-run-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>install-node-and-npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>${frontend-maven-plugin.nodeVersion}</nodeVersion>
                            <npmVersion>${frontend-maven-plugin.npmVersion}</npmVersion>
                            <skip>${skipJavaScriptTests}</skip>
                        </configuration>
                        <phase>test</phase>
                    </execution>

                    <!-- Install JavaScript dependencies using npm -->
                    <execution>
                        <id>npm-install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                            <skip>${skipJavaScriptTests}</skip>
                        </configuration>
                        <phase>test</phase>
                    </execution>

                    <!-- Run JavaScript tests -->
                    <execution>
                        <id>npm-test</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run test</arguments>
                            <skip>${skipJavaScriptTests}</skip>
                        </configuration>
                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
