Compile a JVM Target
You need to compile a JVM binary or library target that you're working on, e.g. to ensure that the target compiles successfully.
compile goal enables you to compile Scala or Java binaries and libraries. Here's an example:
$ ./pants compile examples/src/scala/org/pantsbuild/hello/exe:exe
compile goal requires you to target a
BUILD file containing either a
scala_binary target. For the CLI example above, the target
BUILD file might look something like this:
jvm_binary( dependencies=[ 'examples/src/scala/org/pantsbuild/example/hello/welcome:welcome', ], source='Exe.scala', main='org.pantsbuild.example.hello.exe.Exe', )
This works somewhat differently if you're working on Python projects. Because Python doesn't require compilation,
python_library targets do not need a separate compilation phase. You can, however, compile Python CLI apps into PEX files, using a
python_binary target. See Build a Python Executable and Run a Binary Target for more info.