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

<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you 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>
        <groupId>org.odftoolkit</groupId>
        <artifactId>odftoolkit</artifactId>
        <version>0.10.0</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>odfdom-java</artifactId>
    <version>0.10.0</version>
    <packaging>jar</packaging>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/xerces/xercesImpl -->
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/xalan/serializer -->
        <!-- Used by org/odftoolkit/odfdom/IElementWriter.java -->
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
            <version>2.7.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>jena-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>jena-core</artifactId>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.rootdev</groupId>
            <artifactId>java-rdfa</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.8.0-beta4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.8.0-beta4</version>
        </dependency>-->
        <!-- http://logging.apache.org/log4j/2.x/log4j-slf4j-impl/index.html
        NOTE: SLF4J and LOG4J dependencies are given directly in pom.xml
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j18-impl</artifactId>
            <version>2.12.1</version>
        </dependency>-->
        <dependency>
            <groupId>io.github.git-commit-id</groupId>
            <artifactId>git-commit-id-maven-plugin</artifactId>
            <version>5.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-compress</artifactId>
            <version>1.21</version>
        </dependency>
    </dependencies>
    <properties>
        <skipTests>false</skipTests>
        <maven.javadoc.skip>false</maven.javadoc.skip>
        <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss</maven.build.timestamp.format>
    </properties>

    <!-- Build Settings -->
    <build>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-webdav-jackrabbit</artifactId>
                <version>3.4.3</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <!-- defined in the parent pom.xml -->
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <testSource>${jdk.version}</testSource>
                    <testTarget>${jdk.version}</testTarget>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <!--
                    <compilerArgs>
                        <arg>-Xlint:unchecked</arg>
                        <arg>-Xlint:deprecation</arg>
                    </compilerArgs>
                    -->
                    <!--
                    <compilerArgs>
                        <arg>-verbose</arg>
                        <arg>-Xlint:all,-options,-path</arg>
                    </compilerArgs>
                    -->
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifest>
                            <mainClass>org.odftoolkit.odfdom.JarManifest</mainClass>
                        </manifest>
                        <manifestEntries>
                            <version>${project.version}</version>
                        </manifestEntries>
                        <!-- see https://stackoverflow.com/questions/53049346/is-log4j2-compatible-with-java-11/57616897#57616897 -->
                        <manifestEntries>
                            <Multi-Release>true</Multi-Release>
                        </manifestEntries>
                        <manifestSections>
                            <manifestSection>
                                <name>ODFDOM</name>
                                <manifestEntries>
                                    <ODFDOM-Name>odfdom</ODFDOM-Name>
                                    <ODFDOM-Version>${project.version}</ODFDOM-Version>
                                    <ODFDOM-Website>${project.url}</ODFDOM-Website>
                                    <ODFDOM-Built-Date>${build.timestamp}</ODFDOM-Built-Date>
                                    <ODFDOM-Supported-Odf-Version>1.2</ODFDOM-Supported-Odf-Version>
                                </manifestEntries>
                            </manifestSection>
                        </manifestSections>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>5.1.2</version>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                        <configuration>
                            <instructions>
                                <Import-Package>
                                   org.odftoolkit.odfdom;version="${osgi.import.range}",
                                   org.odftoolkit.odfdom.*;version="${osgi.import.range}",
                                   *
                                </Import-Package>
                            </instructions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <version>5.0.0</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos-validate</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludeProperties>
                        <excludeProperty>git.*.user.*</excludeProperty>
                    </excludeProperties>
                    <prefix>git</prefix>
                    <verbose>true</verbose>
                    <skipPoms>false</skipPoms>
                    <!-- <runOnlyOnce>true</runOnlyOnce> -->
                    <dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
                    <injectAllReactorProjects>true</injectAllReactorProjects>
                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
                    <evaluateOnCommit>HEAD</evaluateOnCommit>
                    <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <!--                    <forkCount>3</forkCount>
                    <reuseForks>true</reuseForks>-->
                    <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
                    <systemPropertyVariables>
                        <odfdom.version>${project.version}</odfdom.version>
                        <org.odftoolkit.odfdom.validation>true</org.odftoolkit.odfdom.validation>
                        <odfdom.git.branch>${git.branch}</odfdom.git.branch>
                        <odfdom.git.commit.id.describe>${git.commit.id.describe}</odfdom.git.commit.id.describe>
                        <odfdom.git.remote.origin.url>${git.remote.origin.url}</odfdom.git.remote.origin.url>
                        <odfdom.git.commit.time>${git.commit.time}</odfdom.git.commit.time>
                    </systemPropertyVariables>
                    <skipTests>${skipTests}</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <!-- Workaround: Build the project using the same JDK version as the project is targetting.
                        see https://issues.apache.org/jira/browse/MJAVADOC-562
                        see https://bugs.openjdk.java.net/browse/JDK-8212233
                    -->
                    <source>${jdk.version}</source>
                    <doctitle>ODFDOM v${project.version}</doctitle>
                    <bottom>${javadoc.bottom}</bottom>
                    <isOffline>false</isOffline>
                    <links>
                        <link>https://xerces.apache.org/xerces-j/apiDocs/</link>
                    </links>
                    <splitindex>true</splitindex>
                    <windowtitle>ODFDOM API v${project.version} - https://odftoolkit.org/</windowtitle>
                    <taglets>
                        <taglet>
                            <tagletClass>org.odftoolkit.odfdom.taglet.OdfElementTaglet</tagletClass>
                        </taglet>
                        <taglet>
                            <tagletClass>org.odftoolkit.odfdom.taglet.OdfAttributeTaglet</tagletClass>
                        </taglet>
                        <taglet>
                            <tagletClass>org.odftoolkit.odfdom.taglet.OdfDatatypeTaglet</tagletClass>
                        </taglet>
                    </taglets>
                    <tagletArtifact>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>taglets</artifactId>
                        <version>${project.version}</version>
                    </tagletArtifact>
                    <docfilessubdirs>true</docfilessubdirs>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <doclint>none</doclint>
                            <!-- NullPointerException if not set!
                            <additionalOptions>
                                <additionalOption>${javadoc.opts}</additionalOption>
                            </additionalOptions>
                            -->
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <mainClass>org.odftoolkit.odfdom.JarManifest</mainClass>
                        </manifest>
                        <manifestEntries>
                            <version>${project.version}</version>
                        </manifestEntries>
                        <manifestSections>
                            <manifestSection>
                                <name>ODFDOM</name>
                                <manifestEntries>
                                    <ODFDOM-Name>odfdom</ODFDOM-Name>
                                    <ODFDOM-Version>${project.version}</ODFDOM-Version>
                                    <ODFDOM-Website>${project.url}</ODFDOM-Website>
                                    <ODFDOM-Built-Date>${build.timestamp}</ODFDOM-Built-Date>
                                    <ODFDOM-Supported-Odf-Version>1.2</ODFDOM-Supported-Odf-Version>
                                </manifestEntries>
                            </manifestSection>
                        </manifestSections>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>single</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <excludes>
                        <exclude>**/PerformanceIT.java</exclude>
                    </excludes>
                    <systemPropertyVariables>
                        <odfdom.version>${project.version}</odfdom.version>
                        <org.odftoolkit.odfdom.validation>org.odftoolkit.odfdom.pkg.DefaultErrorHandler</org.odftoolkit.odfdom.validation>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>failsafe-it</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <!-- Reporting integration test results -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
                <reportSets>
                    <reportSet>
                        <id>integration-tests</id>
                        <reports>
                            <report>report-only</report>
                        </reports>
                        <configuration>
                            <outputName>failsafe-report</outputName>
                        </configuration>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <!-- More Project Information -->
    <name>ODFDOM</name>
    <description>
        ODFDOM is an OpenDocument Format (ODF) framework. Its purpose
        is to provide an easy common way to create, access and
        manipulate ODF files, without requiring detailed knowledge of
        the ODF specification. It is designed to provide the ODF
        developer community with an easy lightwork programming API
        portable to any object-oriented language.

        The current reference implementation is written in Java.
    </description>
    <url>https://odftoolkit.org/odfdom/</url>
    <inceptionYear>2008</inceptionYear>

    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <organization>
        <name>The Document Foundation</name>
        <url>https://www.documentfoundation.org/</url>
    </organization>
    <scm>
        <connection>scm:git:git://github.com/tdf/odftoolkit.git</connection>
        <developerConnection>scm:git:git@github.com:tdf/odftoolkit.git</developerConnection>
        <url>https://github.com/tdf/odftoolkit/tree/trunk/odfdom</url>
        <tag>odftoolkit-0.10.0</tag>
    </scm>
    <profiles>
        <profile>
            <id>codegen</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>wagon-maven-plugin</artifactId>
                        <version>1.0</version>
                        <executions>
                            <execution>
                                <id>download-odf-schema-v1.2</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>download-single</goal>
                                </goals>
                                <configuration>
                                    <url>dav:https://docs.oasis-open.org/office/v1.2</url>
                                    <fromFile>os/OpenDocument-v1.2-os-schema.rng</fromFile>
                                    <toDir>${project.build.directory}/odf-schemas</toDir>
                                </configuration>
                            </execution>
                            <execution>
                                <id>download-odf-manifest-schema-v1.2</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>download-single</goal>
                                </goals>
                                <configuration>
                                    <url>dav:https://docs.oasis-open.org/office/v1.2</url>
                                    <fromFile>os/OpenDocument-v1.2-os-manifest-schema.rng</fromFile>
                                    <toDir>${project.build.directory}/odf-schemas</toDir>
                                </configuration>
                            </execution>
                            <execution>
                                <id>download-odf-dsig-schema-v1.2</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>download-single</goal>
                                </goals>
                                <configuration>
                                    <url>dav:https://docs.oasis-open.org/office/v1.2</url>
                                    <fromFile>os/OpenDocument-v1.2-os-dsig-schema.rng</fromFile>
                                    <toDir>${project.build.directory}/odf-schemas</toDir>
                                </configuration>
                            </execution>
                            <execution>
                                <id>download-odf-schema-v1.1</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>download-single</goal>
                                </goals>
                                <configuration>
                                    <url>dav:https://docs.oasis-open.org/office/v1.1</url>
                                    <fromFile>OS/OpenDocument-schema-v1.1.rng</fromFile>
                                    <toDir>${project.build.directory}/odf-schemas</toDir>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>schema2template-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <executions>
                            <execution>
                                <id>dom</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>codegen</goal>
                                </goals>
                                <!-- DOM LAYER CONFIGURATION -->
                                <configuration>
                                    <targetRoot>${basedir}/src/main/java/</targetRoot>
                                    <domResourceRoot>${basedir}/src/codegen/resources/dom/template</domResourceRoot>
                                    <pkgResourceRoot>${basedir}/src/codegen/resources/pkg/template</pkgResourceRoot>
                                    <odf12SchemaFile>${project.build.directory}/odf-schemas/OpenDocument-v1.2-os-schema.rng</odf12SchemaFile>
                                    <odf11SchemaFile>${project.build.directory}/odf-schemas/OpenDocument-schema-v1.1.rng</odf11SchemaFile>
                                    <signatureSchemaFile>${project.build.directory}/odf-schemas/OpenDocument-v1.2-os-dsig-schema.rng</signatureSchemaFile>
                                    <manifestSchemaFile>${project.build.directory}/odf-schemas/OpenDocument-v1.2-os-manifest-schema.rng</manifestSchemaFile>
                                    <configFile>${basedir}/src/codegen/resources/config.xml</configFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!--
        <profile>
            <id>codegen-pkg</id>
            <activation>
              <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <defaultGoal>install</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.odftoolkit</groupId>
                        <artifactId>maven-codegen-plugin</artifactId>
                        <version>0.8</version>
                        <executions>
                            <execution>
                                <id>pkg</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>codegen</goal>
                                </goals>
                                <configuration>
                                    <sourceRoot>${basedir}/src/main/java</sourceRoot>
                                    <schemaFile>${basedir}/src/codegen/resources/pkg/OpenDocument-manifest-schema-v1.2-draft7.rng</schemaFile>
                                    <configFile>${basedir}/src/codegen/resources/pkg/config.xml</configFile>
                                    <templateFile>${basedir}/src/codegen/resources/pkg/javacodetemplate.xml</templateFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        -->
        <profile>
            <id>integration-test</id>
            <activation>
                <property>
                    <name>integration-test</name>
                </property>
            </activation>
            <build>
                <defaultGoal>verify</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <systemPropertyVariables>
                                <testresourcefolder>performance</testresourcefolder>
                                <executetimes>1</executetimes>
                                <testflag>test</testflag>
                            </systemPropertyVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <id>failsafe-it</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <!--                    <forkCount>3</forkCount>
                            <reuseForks>true</reuseForks>-->
                            <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
                            <systemPropertyVariables>
                                <odfdom.version>${project.version}</odfdom.version>
                                <odfdom.timestamp>${build.timestamp}</odfdom.timestamp>
                                <org.odftoolkit.odfdom.validation>true</org.odftoolkit.odfdom.validation>
                            </systemPropertyVariables>
                            <skipTests>${skipTests}</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
