<?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

       https://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.apache.commons</groupId>
    <artifactId>commons-digester3-parent</artifactId>
    <version>3.3-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>commons-digester3</artifactId>
  <packaging>jar</packaging>

  <name>Apache Commons Digester :: Core</name>

  <dependencies>
    <dependency>
      <groupId>cglib</groupId>
      <artifactId>cglib</artifactId>
      <version>3.3.0</version>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <version>1.11.0</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.3.5</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
    <!-- project.build.outputTimestamp is managed by Maven plugins, see https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
    <project.build.outputTimestamp>2024-01-01T00:00:00Z</project.build.outputTimestamp>
  </properties>
  <build>
    <resources>
      <resource>
        <directory>${basedir}/../</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>NOTICE.txt</include>
          <include>LICENSE.txt</include>
        </includes>
      </resource>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/*.dtd</include>
        </includes>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <executions>
          <execution>
            <id>shaded-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
            <configuration>
              <manifestLocation>${project.build.directory}/osgi-shaded</manifestLocation>
              <instructions>
                <Import-Package>javax.xml.parsers,javax.xml.validation,org.w3c.dom,org.xml.sax,org.xml.sax.helpers</Import-Package>
              </instructions>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>jarjar-maven-plugin</artifactId>
        <version>1.9</version>
        <configuration>
          <input>{classes}</input>
          <output>${project.build.directory}/classes-shaded</output>
          <overwrite>true</overwrite>
          <skipManifest>true</skipManifest>
          <includes>
            <include>*:asm</include>
            <include>*:cglib</include>
            <include>*:commons-beanutils</include>
            <include>*:commons-logging</include>
          </includes>
          <rules>
            <rule>
              <pattern>net.sf.cglib.*</pattern>
              <result>org.apache.commons.digester3.internal.cglib.$@1</result>
            </rule>
            <rule>
              <pattern>net.sf.cglib.**.*</pattern>
              <result>org.apache.commons.digester3.internal.cglib.@1.$@2</result>
            </rule>
            <rule>
              <pattern>org.objectweb.asm.*</pattern>
              <result>org.apache.commons.digester3.internal.asm.$@1</result>
            </rule>
            <rule>
              <pattern>org.objectweb.asm.**.*</pattern>
              <result>org.apache.commons.digester3.internal.asm.@1.$@2</result>
            </rule>
            <keep>
              <pattern>org.apache.commons.**</pattern>
            </keep>
          </rules>
        </configuration>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>jarjar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!--
          - Copy the specific LICENSE.txt and NOTICE.txt files so that they are included
          - in the uberjar jar file.
          -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>uberjar.resources</id>
            <!-- has to run after default N&L files are copied -->
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <copy todir="${project.build.directory}/classes-shaded/META-INF/" overwrite="true">
                  <fileset dir="${basedir}/../commons-digester3-dist/src/main/assembly/">
                    <include name="*.txt" />
                  </fileset>
                  <mapper type="regexp" from="^(.*)-with-deps\.txt" to="\1.txt" />
                </copy>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classesDirectory>${project.build.outputDirectory}</classesDirectory>
            </configuration>
          </execution>
          <execution>
            <id>jarjar</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <archive>
                <manifestFile>${project.build.directory}/osgi-shaded/MANIFEST.MF</manifestFile>
              </archive>
              <classesDirectory>${project.build.directory}/classes-shaded</classesDirectory>
              <classifier>with-deps</classifier>
              <excludes>
                <exclude>**/LICENSE</exclude>
                <exclude>**/NOTICE</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <configuration>
            <configLocation>config/maven_checks.xml</configLocation>
            <headerLocation>config/maven-header.txt</headerLocation>
            <suppressionsLocation>${basedir}/checkstyle-suppressions.xml</suppressionsLocation>
            <suppressionsFileExpression>${basedir}/checkstyle-suppressions.xml</suppressionsFileExpression>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.shared</groupId>
              <artifactId>maven-shared-resources</artifactId>
              <version>6</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

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

</project>
