com-lihaoyi / mill

Your shiny new Java/Scala build tool!

Home Page:https://mill-build.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add `Premain-Class` attribute to JAR manifest?

amordahl opened this issue · comments

I am new to using Mill, and I am trying to build an instrumentation agent, but I can't figure out how to generate a manifest file that includes a Premain-Class attribute. I noticed issue 624 said that "You can overwrite the def manifest: T[JarManifest] target and append any manifest entry you want" but I'm not really sure how to achieve this. Thanks!

You can add a Premain-Class entry to the manifest by overriding the manifest target of your JavaModule or ScalaModule:

def manifest = T {
  super.manifest().add("Premain-Class" -> "org.example.PremainAgent")
}