I need to build a single jar, including dependencies, for one of my sub-projects so that it can be used as a javaagent
.
I have a multi-module sbt project and this particular module is the lowest level one (it's also pure Java).
Can I (e.g. with sbt-onejar, sbt-proguard or sbt assembly) override how the lowest level module is packaged?
It looks like these tools are really designed to be a post-publish step, but I really need a (replacement or additional) published artefact to include the dependencies (but only for this one module).
UPDATE: Publishing for sbt-assembly are instructions for a single project, and doesn't easily translate into multi-project.
People have been publishing fat JAR using sbt-assembly & sbt-release without issues. Here's a blog article from 2011: Publishing fat jar created by sbt-assembly. It boils down to adding
addArtifact(Artifact(projectName, "assembly"), sbtassembly.AssemblyKeys.assembly)
to yourbuild.sbt
(note that the blog is a little out of dateAssemblyKeys
is now a member ofsbtassembly
directly).For sbt 0.13 and above, I prefer to use
build.sbt
for multi-projects too, so I'd write it like:See Defining custom artifacts: