Define a JVM Executable
Problem
You need to specify a Scala or Java binary target that you can compile and/or run directly.
If you need to specify a Scala or Java library target, see Create a New Scala or Java Library Target.
Solution
Create a jvm_binary target definition for your project that specifies which scala_library or java_library target will be included in the binary (you can also include several).
Discussion
In any jvm_binary target you must specify the following:
- A
namefor the target - A
basenamethat will be used as the basis of the filename if you bundle the target using ajvm_apptarget - The
mainfunction which serves as the executable's entry point. - A list of
dependenciesthat must include at least onescala_libraryorjava_librarytarget. More info can be found in Add a Dependency from Source. - A list of file
bundlesfor use as static assets (optional). More info can be found in Specify a File Bundle.
Here's an example jvm_binary definition:
jvm_binary( name='bin', basename='myproject-bin', main='com.acme.myproject.Main', dependencies=[ 'src/java/com/myorg/myproject/server', 'src/java/com/myorg/myproject/analytics', ], bundles=[ bundle(fileset=['assets/*']), ] )
See Also
Generated by publish_docs
from dist/markdown/html/src/docs/common_tasks/jvm_binary.html 2022-12-03T01:08:59.562143