Windymelt
Windymelt

Reputation: 189

Mill: How to generate uberjar using publishVersion?

Mill can generate (Uber)jar by mill assembly. Generated file is located at out/assembly.dest/out.jar.

How can I customize output filename instead of out.jar? I'd like to use value of publishVersion (I'm using mill-vcs-version).

sbt can generate well-named uberjar.

Upvotes: 0

Views: 94

Answers (1)

Tobias Roeser
Tobias Roeser

Reputation: 546

You can customize the outcome by overriding the assembly target.

def assembly(): T[PathRef] = T {
  val dest = T.dest / s"${artifactName()}-${publishVersion()}-assembly.jar"
  os.copy(super.assembly().path, dest)
  PathRef(dest)
}

Instead of artifactName, you could also use artifactId, which would also contain the Scala version suffix and potential platform suffixes.

If you need those kind of customizations in multiple places, you should consider using a trait module.

Upvotes: 0

Related Questions