Skip to content

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

License

Notifications You must be signed in to change notification settings

idio/sbt-assembly-log4j2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Setup

For sbt 0.13.6+ add sbt-assembly-log4j2 as a dependency in project/assembly.sbt alongside sbt-assembly:

resolvers += Resolver.url(
  "idio",
  url("http://dl.bintray.com/idio/sbt-plugins")
)(Resolver.ivyStylePatterns)

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "<version>")
addSbtPlugin("org.idio" % "sbt-assembly-log4j2" % "0.1.0")

Fetch from github packages

As bintray is closing down we have published this on github packages

To fetch it you need to set up the github packages sbt plugin

You need to have a personal github token defined in your environment, read more here: https://github.com/djspiewak/sbt-github-packages

project/project/plugins.sbt

addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.2")

project/plugins.sbt

resolvers += Resolver.githubPackages("idio")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "<version>")
addSbtPlugin("org.idio" % "sbt-assembly-log4j2" % "0.1.0")

Usage

In your merge strategy, add the following case:

import sbtassembly.Log4j2MergeStrategy

assemblyMergeStrategy in assembly := {
    //...
    case PathList(ps @ _*) if ps.last == "Log4j2Plugins.dat" => Log4j2MergeStrategy.plugincache
    //...

About

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

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages