
<!--
  ~ JBoss, Home of Professional Open Source.
  ~
  ~ Copyright 2023 Red Hat, Inc.
  ~
  ~ 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.
  -->

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

    <parent>
        <groupId>org.jboss.logging</groupId>
        <artifactId>logging-parent</artifactId>
        <version>1.0.1.Final</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.jboss.logging</groupId>
    <artifactId>jboss-logging</artifactId>
    <version>3.5.3.Final</version>
    <packaging>jar</packaging>
    <name>JBoss Logging 3</name>
    <url>http://www.jboss.org</url>
    <description>The JBoss Logging Framework</description>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>


    <scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false"
         child.scm.url.inherit.append.path="false">
        <connection>scm:git:git://github.com/jboss-logging/jboss-logging.git</connection>
        <developerConnection>scm:git:git@github.com:jboss-logging/jboss-logging.git</developerConnection>
        <url>https://github.com/jboss-logging/jboss-logging/tree/main/</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <!-- Dependency versions -->
        <version.ch.qos.logback>1.4.8</version.ch.qos.logback>
        <version.module-info>2.1</version.module-info>
        <version.org.apache.log4j>1.2.17</version.org.apache.log4j>
        <version.org.apache.logging.log4j>2.20.0</version.org.apache.logging.log4j>
        <version.org.jboss.logmanager>2.1.19.Final</version.org.jboss.logmanager>
        <version.org.junit>5.9.3</version.org.junit>
        <version.org.sfl4j>2.0.7</version.org.sfl4j>

        <!-- Override the parent version to compile with Java 17 -->
        <version.bundle.plugin>5.1.3</version.bundle.plugin>

        <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
        <cp.test.classes.dir>${project.build.directory}${file.separator}cp-test-classes</cp.test.classes.dir>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.org.junit}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.jboss.logmanager</groupId>
            <artifactId>jboss-logmanager</artifactId>
            <version>${version.org.jboss.logmanager}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${version.org.apache.log4j}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${version.org.apache.logging.log4j}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${version.org.sfl4j}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${version.ch.qos.logback}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${version.org.apache.logging.log4j}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>impsort-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <useModulePath>false</useModulePath>
                </configuration>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                        <configuration>
                            <testExcludes>
                                <testExclude>**/*ClassPathTestCase.java</testExclude>
                            </testExcludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>cp-test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <phase>test-compile</phase>
                        <configuration>
                            <outputDirectory>${cp.test.classes.dir}</outputDirectory>
                            <skip>${skip.cp.tests}</skip>
                            <testIncludes>
                                <testInclude>**/*ClassPathTestCase.java</testInclude>
                            </testIncludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <redirectTestOutputToFile>${maven.test.redirectTestOutputToFile}</redirectTestOutputToFile>
                    <!-- Required so we can test the various providers -->
                    <reuseForks>false</reuseForks>
                    <skip>true</skip>
                    <useModulePath>false</useModulePath>
                </configuration>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <excludes>
                                <exclude>**/*ClassPathTestCase.java</exclude>
                            </excludes>
                            <systemPropertyVariables>
                                <!-- This is required as JUnit 5 initializes a logger too early for it to be set
                                     in the JBossLogManagerTestCase. -->
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jboss-logmanager-cp-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <useModulePath>false</useModulePath>
                            <testClassesDirectory>${cp.test.classes.dir}</testClassesDirectory>
                            <includes>
                                <include>**/JBossLogManagerClassPathTestCase.java</include>
                            </includes>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.apache.logging.log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>org.slf4j</classpathDependencyExclude>
                                <classpathDependencyExclude>ch.qos.logback</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                            <systemPropertyVariables>
                                <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                    <execution>
                        <id>log4j2-cp-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <skip>false</skip>
                            <testClassesDirectory>${cp.test.classes.dir}</testClassesDirectory>
                            <includes>
                                <include>**/Log4j2ClassPathTestCase.java</include>
                            </includes>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.jboss.logmanager</classpathDependencyExclude>
                                <classpathDependencyExclude>log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>org.slf4j</classpathDependencyExclude>
                                <classpathDependencyExclude>ch.qos.logback</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>log4j-cp-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <skip>false</skip>
                            <testClassesDirectory>${cp.test.classes.dir}</testClassesDirectory>
                            <includes>
                                <include>**/Log4jClassPathTestCase.java</include>
                            </includes>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.apache.logging.log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>org.jboss.logmanager</classpathDependencyExclude>
                                <classpathDependencyExclude>org.slf4j</classpathDependencyExclude>
                                <classpathDependencyExclude>ch.qos.logback</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>slf4j-cp-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <skip>false</skip>
                            <testClassesDirectory>${cp.test.classes.dir}</testClassesDirectory>
                            <includes>
                                <include>**/Slf4jClassPathTestCase.java</include>
                            </includes>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.apache.logging.log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>org.jboss.logmanager</classpathDependencyExclude>
                                <classpathDependencyExclude>log4j</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jul-cp-test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>false</skip>
                            <testClassesDirectory>${cp.test.classes.dir}</testClassesDirectory>
                            <includes>
                                <include>**/JulClassPathTestCase.java</include>
                            </includes>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>org.apache.logging.log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>org.jboss.logmanager</classpathDependencyExclude>
                                <classpathDependencyExclude>log4j</classpathDependencyExclude>
                                <classpathDependencyExclude>org.slf4j</classpathDependencyExclude>
                                <classpathDependencyExclude>ch.qos.logback</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Adding OSGI metadata to the JAR without changing the packaging type. -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <additionalJOption>--no-module-directories</additionalJOption>
                    <doclint>none</doclint>
                    <!-- Get around issues with module errors when producing JavaDocs for releases. The generated JavaDoc
                         is still generated with the Java 9+ style.
                    -->
                    <release>8</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Automatic-Module-Name>org.jboss.logging</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                    <instructions>
                        <Export-Package>
                            ${project.groupId}.*;version=${project.version};-split-package:=error
                        </Export-Package>
                        <Import-Package>
                            org.apache.log4j.config;resolution:=optional,
                            *;resolution:=optional
                        </Import-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.github.dmlloyd.module-info</groupId>
                <artifactId>module-info</artifactId>
                <version>${version.module-info}</version>
                <executions>
                    <execution>
                        <id>module-info</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>jboss-public-repository-group</id>
            <name>JBoss Public Repository Group</name>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
            <layout>default</layout>
        </repository>
    </repositories>
</project>
