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

    <groupId>net.logstash.logback</groupId>
    <artifactId>logstash-logback-encoder</artifactId>
    <version>7.3-SNAPSHOT</version>

    <name>Logstash Logback Encoder</name>
    <description>Provides logback encoders, layouts, and appenders to log in JSON and other formats supported by Jackson</description>
    <url>https://github.com/logfellow/logstash-logback-encoder</url>
    <inceptionYear>2013</inceptionYear>

    <scm>
        <url>https://github.com/logfellow/logstash-logback-encoder</url>
        <connection>scm:git:https://github.com/logfellow/logstash-logback-encoder</connection>
        <developerConnection>scm:git:https://github.com/logfellow/logstash-logback-encoder</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- runtime dependencies -->
        <jackson.version>2.13.3</jackson.version>
        <java-uuid-generator.version>4.0.1</java-uuid-generator.version>
        <logback.version>1.2.11</logback.version>

        <!-- shaded runtime dependencies -->
        <disruptor.version>3.4.4</disruptor.version>

        <!-- test dependencies -->
        <assertj.version>3.22.0</assertj.version>
        <awaitility.version>4.2.0</awaitility.version>
        <javax-servlet-api.version>4.0.1</javax-servlet-api.version>
        <junit.version>5.8.2</junit.version>
        <mockito.version>4.5.1</mockito.version>

        <!-- maven plugins -->
        <animal-sniffer-maven-plugin.version>1.21</animal-sniffer-maven-plugin.version>
        <license-maven-plugin.version>4.1</license-maven-plugin.version>
        <maven-bundle-plugin.version>5.1.6</maven-bundle-plugin.version>
        <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
        <maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>3.1.0</maven-enforcer-plugin.version>
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <maven-install-plugin.version>3.0.0-M1</maven-install-plugin.version>
        <maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>3.4.0</maven-javadoc-plugin.version>
        <maven-release-plugin.version>2.5.3</maven-release-plugin.version>
        <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
        <maven-shade-plugin.version>3.3.0</maven-shade-plugin.version>
        <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
        
        <checkstyle.version>9.2.1</checkstyle.version>
        
        <!-- maven-javadoc-plugin configuration -->
        <maven.javadoc.failOnError>true</maven.javadoc.failOnError>
        <maven.javadoc.failOnWarnings>true</maven.javadoc.failOnWarnings>

        <!-- the server id the maven-release-plugin uses to obtain credentials to use when pushing tags/commits -->
        <project.scm.id>github</project.scm.id>
    </properties>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
        <license>
            <name>MIT License</name>
            <url>http://www.slf4j.org/license.html</url>
            <comments>
                The portion of LogstashBasicMarker.java that has been copied from 
                org.slf4j.helpers.BasicMarker is released under the MIT License.
            </comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>neilprosser</id>
            <name>Neil Prosser</name>
            <email>neil.prosser@gmail.com</email>
            <organization>Nokia</organization>
            <organizationUrl>http://music.nokia.com</organizationUrl>
        </developer>
        <developer>
            <id>philsttr</id>
            <name>Phil Clay</name>
        </developer>
        <developer>
            <id>lusis</id>
            <name>John E. Vincent</name>
            <email>lusis.org+github.com@gmail.com</email>
        </developer>
        <developer>
            <id>brenuart</id>
            <name>Bertrand Renuart</name>
        </developer>
    </developers>

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

    <dependencies>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <!--
               Required for logging regular ILoggingEvents with a Logger.
               Not needed if only logging IAccessEvents for access logs. 
            -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>${logback.version}</version>
            <!--
               Required for logging IAccessEvents for access logs. 
               Not needed if only logging regular ILoggingEvents with a Logger.
            -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
            <!--
               "provided" since users of logstash-logback-encoder must also
               directly depend on logback-classic or logback-access,
               and both of those depend on logback-core transitively.
            -->
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${javax-servlet-api.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-cbor</artifactId>
            <!--
                Only needed if net.logstash.logback.decorate.cbor is used.
            -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-smile</artifactId>
            <!--
                Only needed if net.logstash.logback.decorate.smile is used.
            -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <!--
                Only needed if net.logstash.logback.decorate.yaml is used.
            -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.uuid</groupId>
            <artifactId>java-uuid-generator</artifactId>
            <version>${java-uuid-generator.version}</version>
            <!--
               Only needed if the UuidProvider is used.
            -->
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
            <version>${disruptor.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${awaitility.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[1.8,)</version>
                                </requireJavaVersion>
                                <requireMavenVersion>
                                    <version>[3.5.0,)</version>
                                </requireMavenVersion>
                                
                                <!-- Verify that there are no classes in dependencies having bytecode versions
                                     higher than the minimum JDK version we support.
                                 -->
                                <enforceBytecodeVersion>
                                    <maxJdkVersion>1.8</maxJdkVersion>
                                    <ignoreClasses>
                                        <ignoreClass>META-INF/versions/*</ignoreClass>
                                    </ignoreClasses>
                                </enforceBytecodeVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>extra-enforcer-rules</artifactId>
                        <version>1.5.1</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>animal-sniffer-maven-plugin</artifactId>
                <version>${animal-sniffer-maven-plugin.version}</version>
                <configuration>
                    <signature>
                        <groupId>org.codehaus.mojo.signature</groupId>
                        <artifactId>java18</artifactId>
                        <version>1.0</version>
                    </signature>
                </configuration>
                <executions>
                    <execution>
                        <id>ensure-java-1.8-compatible</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifestEntries>
                            <Automatic-Module-Name>logstash.logback.encoder</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>${maven-shade-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <shadedArtifactAttached>false</shadedArtifactAttached>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <createSourcesJar>true</createSourcesJar>
                    <shadeSourcesContent>true</shadeSourcesContent>
                    <minimizeJar>true</minimizeJar>
                    <artifactSet>
                        <includes>
                            <include>com.lmax:disruptor</include>
                        </includes>
                    </artifactSet>
                    <filters>
                        <filter>
                            <artifact>com.lmax:disruptor</artifact>
                            <excludes>
                                <exclude>META-INF/MANIFEST.MF</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <relocations>
                        <relocation>
                            <pattern>com.lmax.disruptor</pattern>
                            <shadedPattern>${project.groupId}.encoder.com.lmax.disruptor</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${maven-bundle-plugin.version}</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <instructions>
                        <!-- packages to export -->
                        <Export-Package>net.logstash.logback.*</Export-Package>
                        <!-- attach to Logback bundle as fragment -->
                        <Fragment-Host>ch.qos.logback.classic</Fragment-Host>
                        <!-- exclude following imports as required classes are relocated by shade plugin and ignore ch.qos.logback.[core,classic] because this is a fragment and gets them from parent. -->
                        <Import-Package>!com.lmax.disruptor.*,!ch.qos.logback.classic.*,!ch.qos.logback.core.*,!org.slf4j.*,*</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            <!-- Install JaCoCo agent and produce reports at the end of the build.
            -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jacoco-prepare-agent</id>
                        <phase>process-test-classes</phase> <!-- must be ready for the `test` phase, default is "initialize" -->
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-report</id>
                        <phase>verify</phase> <!-- this is the default -->
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                    <configuration>
                        <filesets>
                            <!-- Remove dependency reduced pom file created by maven-shade-plugin
                                 in the basedir of the project
                             -->
                            <fileset>
                                <directory>.</directory>
                                <includes>
                                    <include>dependency-reduced-pom.xml</include>
                                </includes>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <!--
                            GitHub CI runs tests against different jackson versions.
                            Therefore, differentiate the report directories by jackson versions.
                        -->
                        <reportsDirectory>${project.build.directory}/surefire-reports/jackson-${jackson.version}</reportsDirectory>
                    </configuration>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <!-- Enable all validation checks except "accessibility"
                         -->
                        <doclint>all,-accessibility</doclint>
                        
                        <!-- Setup links to external api docs
                         -->
                        <links>
                            <link>https://javadoc.io/doc/ch.qos.logback/logback-core/${logback.version}</link>
                            <link>https://javadoc.io/doc/ch.qos.logback/logback-classic/${logback.version}</link>
                            <link>https://javadoc.io/doc/ch.qos.logback/logback-access/${logback.version}</link>
                            <link>https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-core/${jackson.version}</link>
                            <link>https://javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/${jackson.version}</link>
                        </links>
                        
                        <!-- Explicitly set version. This should help to get rid of the following
                             warning when building the project with JDK 11+:
                             
                                The code being documented uses modules but the packages defined in
                                https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
                         -->
                        <source>${java.version}</source>
                        
                        <!-- Shuts off non-error and non-warning messages, leaving only the
                             warnings and errors appear.
                         -->
                        <quiet>true</quiet>
                    </configuration>
                </plugin>
                
                <!-- Configure checkstyle with sensible defaults for this project so it can be
                     executed standalone from the CLI as follows:
                     
                         mvn checkstyle:check
                 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${maven-checkstyle-plugin.version}</version>
                    <configuration>
                        <configLocation>src/checkstyle/checkstyle.xml</configLocation>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                              <artifactId>checkstyle</artifactId>
                              <version>${checkstyle.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven-plugin.version}</version>
                    <configuration>
                        <header>license-header.txt</header>
                        <mapping>
                            <java>SLASHSTAR_STYLE</java>
                        </mapping>
                        <includes>
                            <include>src/main/java/**</include>
                            <include>src/test/java/**</include>
                        </includes>
                        <defaultProperties>
                            <year>2022</year>
                        </defaultProperties>
                    </configuration>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                </plugin>
                
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                </plugin>
                
                <!-- Java Code Coverage (JaCoCo)
                 -->
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.8</version>
                    <configuration>
                        <!-- Only instrument "net.logstash.**" by default
                         -->
                        <includes>
                            <include>net/logstash/**</include>
                        </includes>
                        
                        <!-- Produce XML report for Codecov, and HTML for local builds if user wants to
                             have a look at it...    
                         -->
                        <formats>
                            <format>XML</format>
                            <format>HTML</format>
                        </formats>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <profiles>
        <profile>
            <id>ossrh</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>java15</id>
            <activation>
                <jdk>[1.15,)</jdk>
            </activation>
            <properties>
                <!-- A warning is emitted when javadoc is missing on a public/protected method.
                     Temporarily disable failure in this case until the code is fully documented.
                -->
                <maven.javadoc.failOnWarnings>false</maven.javadoc.failOnWarnings>
            </properties>
        </profile>

        <profile>
            <id>github</id>
            <activation>
                <property>
                    <name>env.CI</name>
                </property>
            </activation>
            <properties>
                <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
            </properties>
        </profile>
        
        <!--
            Profile used by the Eclipse Maven plugin (m2eclipse).
       
            Activation:
                Profile is activated if the property "m2e.version" is found.
                The Eclipse plugin automatically exports this property which in turn causes the profile
                to be automatically activated under Eclipse.
         -->
        <profile>
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>

            <build>
                <!--
                    Tell eclipse to use another directory for its generated classes than the one
                    used by the command line Maven.
                 -->
                <directory>target-eclipse</directory>
            </build>
        </profile>
        
        <!-- 
            "Fast" profile that can be used during local development to disable most of the "heavy"
            steps not strictly required to produce a final jar.
         -->
        <profile>
            <id>fast</id>
            <properties>
                <maven.javadoc.skip>true</maven.javadoc.skip>
                <license.skip>true</license.skip>
                <checkstyle.skip>true</checkstyle.skip>
            </properties>
        </profile>
    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

</project>