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.


The compile goal enables you to compile Scala or Java binaries and libraries. Here's an example:

$ ./pants compile src/scala/com/myorg/myproject/hello/exe:exe

The compile goal requires you to target a BUILD file containing either a java_library, scala_library, java_binary or scala_binary target. For the CLI example above, the target BUILD file might look something like this:



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.

Generated by publish_docs from dist/markdown/html/src/docs/common_tasks/compile.html 2020-06-13T00:50:52.189633