pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.31k stars 634 forks source link

scala 2.12 ClassNotFoundException when run jar which was built via `binary` command #8300

Closed k-bespalov closed 5 years ago

k-bespalov commented 5 years ago

if I compile me project with --scala-version=2.12 compilation is successful, but when I construct jar via binary command, jar doesn’t contain scala library and I get ClassNotFoundException. how to get fat jar..?

stuhood commented 5 years ago

By default, binary produces a collection of jars with a jar at the root that you can run via java -jar $rootjar. That root jar has a Manifest entry that loads the jars from the lib dir. See https://www.pantsbuild.org/jvm_projects.html#bundles-deploy-able-runnable-file-trees for some mostly up-to-date info.

If you'd like a fatjar, you can set the deployjar=True argument on your jvm_binary/jvm_app target: can "find-in-page" on https://www.pantsbuild.org/build_dictionary.html for "deployjar"