Welcome! Please see the About page for a little more info on how this works.

+3 votes
in tools.build by
closed by

There are several reasons we need to customize the META-INF/MANIFEST.MF file created by clojure.tools.build.api/uber:

  1. A Java library we use, Liquibase, requires a Liquibase-Package entry in the manifest file to be used inside uberjars
  2. We'd like to exclude Multi-Release: true from the built uberjar even tho some of our libs our multi-release. Log4j is an order of magnitude slower in a multi-release JAR and until we figure out how to fix that issue we've just been creating single-release JARs

With Leiningen you can specify the contents of the manifest by including a :manifest key in project.clj... adding an option like that to tools.build would be extremely helpful.

closed with the note: available in v0.1.4

3 Answers

0 votes

Regarding the log4j slowdown, perhaps have a look at https://github.com/line/armeria/issues/2306 which showed similar symptoms and was due to specific calls in the client code (not log4j itself) that used a long-deprecated method.

For what it's worth, we saw the opposite problem: before depstar added the Multi-Release: true detection/setting, log4j2 for us was painfully slow on Java 11 (but fine on Java 8) because it was falling back to reflection and a stack-walker, as I recall.

Regarding :manifest configuration: that's something already built into depstar which now has an API offering drop-in replacements for tools.build's jar and uber functions (with the exact same inputs and returns).

I'd be happy to add an option to disable MR detection to depstar if you want to try it with tools.build? See https://cljdoc.org/d/com.github.seancorfield/depstar/2.1.267/doc/tools-build-usage for details.

0 votes
0 votes

Added custom manifest attribute support (including overrides for the automatic stuff) in jar and uber tasks in tools.build v0.1.4.

(uber {...
       :manifest {"Liquibase-Package" "whatever"
                  "Multi-Release" false}})