<?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.apache.logging.log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>2.20.0</version>
  </parent>
  <artifactId>log4j-core</artifactId>
  <packaging>jar</packaging>
  <name>Apache Log4j Core</name>
  <description>The Apache Log4j Implementation</description>
  <properties>
    <log4jParentDir>${basedir}/..</log4jParentDir>
    <docLabel>Core Documentation</docLabel>
    <projectDir>/core</projectDir>
    <javadoc.skip>false</javadoc.skip>
  </properties>
  <dependencies>
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>javax.activation-api</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <!-- Used for JMS appenders (needs an implementation of course) -->
    <dependency>
      <groupId>javax.jms</groupId>
      <artifactId>javax.jms-api</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <!-- Required for SMTPAppender -->
    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>javax.mail-api</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <!-- Used for OSGi bundle support -->
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- Naturally, all implementations require the log4j-api JAR -->
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </dependency>
    <!-- Used for compressing to formats other than zip and gz -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Used for the CSV layout -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-csv</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Alternative implementation of BlockingQueue using Conversant Disruptor for AsyncAppender -->
    <dependency>
      <groupId>com.conversantmedia</groupId>
      <artifactId>disruptor</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Required for AsyncLoggers -->
    <dependency>
      <groupId>com.lmax</groupId>
      <artifactId>disruptor</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Required for JSON support -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Required for JSON support -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Required for XML layout and receiver support -->
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-xml</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Required for YAML support (including JSON requirements) -->
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Required for console color support in Windows -->
    <dependency>
      <groupId>org.fusesource.jansi</groupId>
      <artifactId>jansi</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Alternative implementation of BlockingQueue using JCTools for AsyncAppender -->
    <dependency>
      <groupId>org.jctools</groupId>
      <artifactId>jctools-core</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Used for ZeroMQ JeroMQ appender -->
    <dependency>
      <groupId>org.zeromq</groupId>
      <artifactId>jeromq</artifactId>
      <optional>true</optional>
    </dependency>
    <!-- Used for Kafka appender -->
    <dependency>
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka-clients</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.sun.mail</groupId>
      <artifactId>javax.mail</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
    </dependency>
    <!-- Kafka needs slf4j -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
    </dependency>
    <!-- POM for jackson-dataformat-xml depends on woodstox-core -->
    <dependency>
      <groupId>com.fasterxml.woodstox</groupId>
      <artifactId>woodstox-core</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/log4j-core-java9</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>org.apache.logging.log4j.core</Bundle-SymbolicName>
            <!-- TODO: exclude internal classes from export -->
            <Export-Package>org.apache.logging.log4j.core.*</Export-Package>
            <Import-Package>
              javax.activation;version="[1.2,2)";resolution:=optional,
              javax.jms;version="[1.1,3)";resolution:=optional,
              javax.mail;version="[1.6,2)";resolution:=optional,
              javax.mail.internet;version="[1.6,2)";resolution:=optional,
              javax.mail.util;version="[1.6,2)";resolution:=optional,
              sun.reflect;resolution:=optional,
              *
            </Import-Package>
            <Bundle-Activator>org.apache.logging.log4j.core.osgi.Activator</Bundle-Activator>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <!-- disable annotation processing for first pass -->
            <id>default-compile</id>
            <configuration>
              <excludes>
                <exclude>module-info.java</exclude>
              </excludes>
              <proc>none</proc>
            </configuration>
          </execution>
          <execution>
            <!-- then do a processing-only pass to generate plugins .dat file -->
            <id>process-plugins</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>process-classes</phase>
            <configuration>
              <excludes>
                <exclude>module-info.java</exclude>
              </excludes>
              <proc>only</proc>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-classes</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.logging.log4j</groupId>
                  <artifactId>log4j-core-java9</artifactId>
                  <version>${project.version}</version>
                  <type>zip</type>
                  <overWrite>false</overWrite>
                </artifactItem>
              </artifactItems>
              <includes>**/*.class</includes>
              <excludes>**/*.java</excludes>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration combine.self="override">
              <archive>
                <manifestFile>${manifestfile}</manifestFile>
                <manifestEntries>
                  <Specification-Title>${project.name}</Specification-Title>
                  <Specification-Version>${project.version}</Specification-Version>
                  <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                  <Implementation-Title>${project.name}</Implementation-Title>
                  <Implementation-Version>${project.version}</Implementation-Version>
                  <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                  <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
                  <X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
                  <X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
                  <Automatic-Module-Name>org.apache.logging.log4j.core</Automatic-Module-Name>
                  <Multi-Release>true</Multi-Release>
                </manifestEntries>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
