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

<!--
  ~ =============================================================================
  ~
  ~   Copyright (c) 2011-2022, The THYMELEAF team (http://www.thymeleaf.org)
  ~
  ~   Licensed 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 https://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-parent</artifactId>
    <version>3.1.3.RELEASE</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>thymeleaf-lib</artifactId>
  <packaging>pom</packaging>
  <name>thymeleaf lib</name>

  <properties>
    <!-- =========================  -->
    <!-- Build file locations       -->
    <!-- =========================  -->
    <disclaimer-files.basedir>${project.basedir}/../..</disclaimer-files.basedir>
    <!-- =========================  -->
    <!-- Configure JavaDoc plugin   -->
    <!-- (Avoids JPMS issues.)      -->
    <!-- =========================  -->
    <maven.javadoc.source>8</maven.javadoc.source>
    <maven.javadoc.release>8</maven.javadoc.release>
    <!-- =========================  -->
    <!-- JPMS MODULE management     -->
    <!-- =========================  -->
    <module.name>TO_BE_SPECIFIED_BY_CHILDREN:module.name</module.name>
  </properties>

  <build>

    <resources>
      <resource>
        <directory>${disclaimer-files.basedir}</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>LICENSE.txt</include>
          <include>NOTICE.txt</include>
        </includes>
      </resource>
    </resources>

    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <!-- Configuration will be inherited from thymeleaf-parent. At this level we will   -->
            <!-- add some additional properties.                                                -->
            <archive>
              <manifestEntries>
                <!-- Setting this automatic module name will fix the module name used by        -->
                <!-- thymeleaf even if the library is not yet fully modularised.                -->
                <!-- NOTE this will have to be set at each of the modules' pom.xml files.       -->
                <Automatic-Module-Name>${module.name}</Automatic-Module-Name>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <show>protected</show>
            <noqualifier>java.lang</noqualifier>
            <source>${maven.javadoc.source}</source>
            <release>${maven.javadoc.release}</release>
            <overview>${basedir}/src/main/javadoc/overview.html</overview>
            <javadocDirectory>${basedir}/src/main/javadoc</javadocDirectory>
            <reportOutputDirectory>${project.build.directory}/apidocs</reportOutputDirectory>
            <doclint>all,-missing</doclint>
          </configuration>
          <executions>
            <execution>
              <id>javadoc-jar</id>
              <phase>package</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <executions>
            <execution>
              <id>source-jar</id>
              <phase>package</phase>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <!-- Copy javadoc's "element-list" file to "package-list" in order to allow         -->
            <!-- projects using versions of the javadoc tool < JDK9 to properly link to         -->
            <!-- Thymeleaf's javadoc as an external link.                                       -->
            <!-- NOTE this modifies the javadoc AFTER the creation of the jar as it is not      -->
            <!-- possible to do so by previously configuring javadoc:javadoc in the             -->
            <!-- prepare-package phase because this "package-list" modification would trigger a -->
            <!-- second execution of the javadoc tool in the javadoc:jar goal.                  -->
            <execution>
              <id>copy-javadoc-element-list-to-package-list</id>
              <phase>package</phase>
              <goals>
                <goal>run</goal>
              </goals>
              <configuration>
                <target name="copy javadocs element-list to package-list">
                  <copy file="${project.build.directory}/apidocs/element-list"
                        tofile="${project.build.directory}/apidocs/package-list"
                        failonerror="false" />
                </target>
              </configuration>
            </execution>
          </executions>
        </plugin>

      </plugins>
    </pluginManagement>

  </build>

  <modules>
    <module>thymeleaf</module>
    <module>thymeleaf-spring5</module>
    <module>thymeleaf-spring6</module>
    <module>thymeleaf-extras-springsecurity5</module>
    <module>thymeleaf-extras-springsecurity6</module>
    <module>testing</module>
  </modules>

</project>
