<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <groupId>org.neo4j</groupId>
        <artifactId>parent</artifactId>
        <version>4.4.44</version>
        <relativePath>../..</relativePath>
    </parent>

    <properties>
        <license-text.header>headers/GPL-3-header.txt</license-text.header>
        <licensing.prepend.text>licensing/notice-gpl-prefix.txt</licensing.prepend.text>
        <moduleName>org.neo4j.logging</moduleName>
        <default.jupiter.test.mode>concurrent</default.jupiter.test.mode>
        <!-- forceCreation because otherwise the jar plugin and shade plugin don't play well together. From the jar plugin docs: "This plugin can not detect the
         post-processing, and so leaves the post-processed jar in place. This can lead to failures when those plugins do not expect to find their own output as
          an input."-->
        <maven.jar.forceCreation>true</maven.jar.forceCreation>
    </properties>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>neo4j-logging</artifactId>

    <packaging>jar</packaging>
    <name>Neo4j - Logging</name>
    <description>Logging interfaces and basic logger implementations.</description>
    <url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>

    <scm>
        <connection>scm:git:git://github.com/neo4j/neo4j.git</connection>
        <developerConnection>scm:git:git@github.com:neo4j/neo4j.git</developerConnection>
        <url>https://github.com/neo4j/neo4j</url>
    </scm>

    <licenses>
        <license>
            <name>GNU General Public License, Version 3</name>
            <url>http://www.gnu.org/licenses/gpl-3.0-standalone.html</url>
            <comments>
                The software ("Software") developed and owned by Neo4j Sweden AB (referred to in this notice as "Neo4j") is
                licensed under the GNU GENERAL PUBLIC LICENSE Version 3 to all third
                parties and that license is included below.

                However, if you have executed an End User Software License and Services
                Agreement or an OEM Software License and Support Services Agreement, or
                another commercial license agreement with Neo4j or one of its
                affiliates (each, a "Commercial Agreement"), the terms of the license in
                such Commercial Agreement will supersede the GNU GENERAL PUBLIC LICENSE
                Version 3 and you may use the Software solely pursuant to the terms of
                the relevant Commercial Agreement.
            </comments>
        </license>
    </licenses>

    <dependencies>
        <!-- WARNING -->
        <!-- Be very careful when adding dependencies in this class -->
        <!-- A bug in the Maven Shade Plugin may cause an infinite loop (livelock) while creating the dependency reduced pom on parallel builds -->
        <!-- It seems to happen if the added dependencies are already transitive dependencies -->
        <!-- Likely fixed by https://github.com/apache/maven-shade-plugin/pull/16 -->
        <!-- Please verify that added dependencies does not break this by doing a full parallel maven build on the root project -->
        <!-- Example "mvn clean install -T -DskipTests" -->
        <!-- WARNING -->
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j-io</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
        </dependency>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>io-test-utils</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <artifactSet>
                        <includes>
                            <include>org.apache.logging.log4j:*</include>
                        </includes>
                    </artifactSet>
                    <relocations>
                        <relocation>
                            <!-- Don't change shadedPattern without updating in Log4jPluginLoadingWorkaround as well -->
                            <pattern>org.apache.logging.log4j</pattern>
                            <shadedPattern>org.neo4j.logging.shaded.log4j</shadedPattern>
                        </relocation>
                        <relocation>
                            <!-- workaround for also relocating log4j multi-release jars -->
                            <pattern>META-INF.versions.9.org.apache.logging.log4j</pattern>
                            <shadedPattern>META-INF.versions.9.org.neo4j.logging.shaded.log4j</shadedPattern>
                        </relocation>
                    </relocations>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <manifestEntries>
                                <Multi-Release>true</Multi-Release>
                            </manifestEntries>
                        </transformer>
                    </transformers>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>**/javax.annotation.processing.Processor</exclude>
                                <!-- Skip the plugins listing file to not interfere with any external Log4j dependencies.
                                     We work around this file not existing in Log4jPluginLoadingWorkaround. -->
                                <exclude>**/Log4j2Plugins.dat</exclude>
                            </excludes>
                        </filter>
                        <filter>
                            <artifact>org.apache.logging.log4j:*</artifact>
                            <excludes>
                                <exclude>META-INF/MANIFEST.MF</exclude>
                                <exclude>META-INF/DEPENDENCIES</exclude>
                                <exclude>META-INF/LICENSE</exclude>
                                <exclude>META-INF/NOTICE</exclude>
                            </excludes>
                        </filter>
                    </filters>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
