Open rmgk opened 1 year ago
@rmgk Thanks for reporting a feature request.
This seems to be a pretty niche use case, so implementing this isn't high on the maintenance team's priority list right now. Contributions are welcome, however!
It could be handle around here with adding new type for PackageType
sealed abstract class. Jars localisation from classPath can be found in Build.Successful.artifacts.classPath
.
someone on Discord asked about this today and I got curious and landed here
I'll just leave some workaround thoughts here. you can run -v
, which produces output comparable to sbt's export fullClasspath
, so then you can see what the relevant JARs are, with full absolute paths. you could take that apart and copy those JARs where you like
that's for the dependencies; for your own code, package --library
produces a non-fat JAR
A simple and straightforward way to package java applications is just as a folder of jars files. Given that all jars are in a folder
jars
the application can be executed viajava --class-path "jars/*" my.MainClass
. Compared to any other method of packaging (bootstrap scripts, assembly (fat) jars) this does not require modifying dependency jars at all, and generally has no potential edge cases that could cause trouble.I would expect the command to be somthing along the lines of
scala-cli package --folder-of-jars --output "jars" .
similar to other package commands. But I have no particular opinion about the concrete wording of--folder-of-jars
. Note that there is some potential relation to my other comment on various packaging flags https://github.com/VirtusLab/scala-cli/issues/1783#issuecomment-1385429857, but I think this is different from packaging a single jar.