<?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.ops4j.pax</groupId>
        <artifactId>logging</artifactId>
        <version>1.11.13</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>org.ops4j.pax.logging</groupId>
    <artifactId>pax-logging-log4j2</artifactId>
    <packaging>bundle</packaging>

    <name>OPS4J Pax Logging - Log4Jv2 implementation</name>

    <description>
        Pax Logging backend implementation based on Apache Log4J2. It provides Log4J2 specific implementation
        of PaxLoggingService interface and Log4J2 specific configuration methods.
        Users may customize Log4J2 behaviour (appenders, layouts) by creating fragment attached to this bundle.
    </description>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!--
                        We can't process annotations (as declared in log4j-core's /META-INF/services/javax.annotation.processing.Processor,
                        which calls org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor) because
                        we want original log4j-core's /META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat.
                        Otherwise it'd be re-generated to include only pax-logging-log4j2's two @Plugins
                    -->
                    <compilerArgument>-proc:none</compilerArgument>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-log4j-core</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.logging.log4j</groupId>
                                    <artifactId>log4j-core</artifactId>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
<!--                    <execution>-->
<!--                        <id>unpack-sources</id>-->
<!--                        <phase>generate-resources</phase>-->
<!--                        <goals>-->
<!--                            <goal>unpack</goal>-->
<!--                        </goals>-->
<!--                        <configuration>-->
<!--                            <artifactItems>-->
<!--                                <artifactItem>-->
<!--                                    <groupId>org.apache.logging.log4j</groupId>-->
<!--                                    <artifactId>log4j-core</artifactId>-->
<!--                                    <classifier>sources</classifier>-->
<!--                                </artifactItem>-->
<!--                            </artifactItems>-->
<!--                            <outputDirectory>-->
<!--                                ${project.build.directory}/sources-->
<!--                            </outputDirectory>-->
<!--                        </configuration>-->
<!--                    </execution>-->
                </executions>
            </plugin>
<!--            <plugin>-->
<!--                <groupId>org.apache.maven.plugins</groupId>-->
<!--                <artifactId>maven-antrun-plugin</artifactId>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <id>copy-sources</id>-->
<!--                        <phase>generate-resources</phase>-->
<!--                        <goals>-->
<!--                            <goal>run</goal>-->
<!--                        </goals>-->
<!--                        <configuration>-->
<!--                            <tasks>-->
<!--                                <echo message="Copying sources to include in sources jar" />-->
<!--                                <mkdir dir="${project.build.directory}/sources" />-->
<!--                                <copy todir="${project.build.directory}/sources">-->
<!--                                    <fileset dir="${project.basedir}/src/main/java" />-->
<!--                                </copy>-->
<!--                            </tasks>-->
<!--                        </configuration>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
<!--            <plugin>-->
<!--                <groupId>org.apache.maven.plugins</groupId>-->
<!--                <artifactId>maven-jar-plugin</artifactId>-->
<!--                <version>3.0.1</version>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <id>enhanced-source-jar</id>-->
<!--                        <phase>package</phase>-->
<!--                        <goals>-->
<!--                            <goal>jar</goal>-->
<!--                        </goals>-->
<!--                        <configuration>-->
<!--                            <classifier>sources</classifier>-->
<!--                            <classesDirectory>${project.build.directory}/sources</classesDirectory>-->
<!--                        </configuration>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->
        </plugins>
    </build>

    <dependencies>

        <!-- Logging -->

        <dependency>
            <groupId>org.knopflerfish.kf6</groupId>
            <artifactId>log-API</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- pax-logging own artifacts -->

        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-api</artifactId>
        </dependency>

        <!-- OSGi -->

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
        </dependency>

        <!-- Testing -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

</project>
