mpollmeier / sbt-assembly-log4j2   1.1.3

MIT License GitHub

A tiny plugin to provide a MergeStrategy for those pesky Log4j2Plugins.dat files

Scala versions: 2.12
sbt plugins: 1.x

sbt-assembly-log4j2

Problem: When including several projects that include log4j2 plugins, sbt-assembly will encounter multiple versions of the Log4j2Plugins.dat cache file that it won't be able to reconcile.

Solution: Log4j2 provides a PluginCache class that creates consistent, serialisable cache from multiple different ones.

This plugin provides a simple function to merge those files in a safe way.

Usage (sbt 1.3+)

project/plugins.sbt:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.1")
addSbtPlugin("com.michaelpollmeier" % "sbt-assembly-log4j2" % "1.1.3")

build.sbt

assembly/assemblyMergeStrategy := {
  case "META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat" =>
    sbtassembly.Log4j2MergeStrategy.plugincache
}

Latest version of sbt-assembly: see https://github.com/sbt/sbt-assembly#setup

Credits