<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  wcm.io
  %%
  Copyright (C) 2014 wcm.io
  %%
  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.
  #L%
  -->

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.wcm</groupId>
    <artifactId>io.wcm.handler.parent</artifactId>
    <version>1.4.14</version>
    <relativePath>../parent/pom.xml</relativePath>
  </parent>

  <groupId>io.wcm</groupId>
  <artifactId>io.wcm.handler.commons</artifactId>
  <version>1.4.4</version>
  <packaging>jar</packaging>

  <name>Handler Commons</name>
  <description>Functionality shared by the handler implementations.</description>
  <url>${site.url}/${site.url.module.prefix}/</url>

  <scm>
    <connection>scm:git:https://github.com/wcm-io/wcm-io-handler.git</connection>
    <developerConnection>scm:git:https://github.com/wcm-io/wcm-io-handler.git</developerConnection>
    <url>https://github.com/wcm-io/wcm-io-handler</url>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <site.url.module.prefix>handler/commons</site.url.module.prefix>

    <!-- Enable reproducible builds -->
    <project.build.outputTimestamp>2021-12-18T09:30:23Z</project.build.outputTimestamp>
  </properties>

  <dependencies>

    <!-- optional dependency from jdom - required for bnd analysis -->
    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.2.0</version>
      <optional>true</optional>
    </dependency>

  </dependencies>

  <build>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependency</id>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <includeArtifactIds>jdom2</includeArtifactIds>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
        <configuration>
          <bnd>
            -exportcontents: \
              ${packages;VERSIONED},\
              org.jdom2.*;version=${jdom2.version}

            <!-- embed JDOM2 dependency -->
            Include-Resource: target/dependency/jdom2-${jdom2.version}.jar
            Bundle-ClassPath: ., jdom2-${jdom2.version}.jar

            Import-Package: \
              org.jaxen.*;resolution:=optional,\
              *
          </bnd>
        </configuration>
      </plugin>
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-baseline-maven-plugin</artifactId>
        <configuration>
          <!-- Temporarily skip baseline check due to jdom update which does not follow semantic versioning -->
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
    <profile>
      <id>only-eclipse</id>
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <versionRange>[3.1.1,)</versionRange>
                        <goals>
                          <goal>copy-dependencies</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore></ignore>
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <site>
      <id>${site.deploy.id}</id>
      <url>${site.deploy.url}/${site.url.module.prefix}</url>
    </site>
  </distributionManagement>

</project>
