# scala_library ```python scala_library( name, srcs, deps, runtime_deps, exports, data, main_class, resources, resource_strip_prefix, scalacopts, jvm_flags, scalac_jvm_flags, javac_jvm_flags, unused_dependency_checker_mode ) ``` `scala_library` generates a `.jar` file from `.scala` source files. This rule also creates an interface jar to avoid recompiling downstream targets unless their interface changes. In order to have a Java rule use this jar file, use the `java_import` rule.
| Attributes | |
|---|---|
name |
A unique name for this target |
srcs |
List of Scala |
deps |
List of other libraries to linked to this library target. These must be jvm targets (scala_library, java_library, java_import, etc...) |
runtime_deps |
List of other libraries to put on the classpath only at runtime. This is rarely needed in Scala. These must be jvm targets (scala_library, java_library, java_import, etc...) |
exports |
List of targets to add to the dependencies of those that depend on this target. Similar to the `java_library` parameter of the same name. Use this sparingly as it weakens the precision of the build graph. These must be jvm targets (scala_library, java_library, java_import, etc...) |
data |
List of files needed by this rule at runtime. |
main_class |
Name of class with main() method to use as an entry point
The value of this attribute is a class name, not a source file. The
class must be available at runtime: it may be compiled by this rule
(from |
resources |
A list of data files to be included in the JAR. |
resource_strip_prefix |
The path prefix to strip from Java resources. If specified, this path prefix is stripped from every file in the `resources` attribute. It is an error for a resource file not to be under this directory. |
scalacopts |
Extra compiler options for this library to be passed to scalac. Subject to Make variable substitution and Bourne shell tokenization. |
jvm_flags |
Deprecated, superseded by scalac_jvm_flags and javac_jvm_flags. Is not used and is kept as backwards compatibility for the near future. Effectively jvm_flags is now an executable target attribute only. |
scalac_jvm_flags |
List of JVM flags to be passed to scalac after the
|
javac_jvm_flags |
List of JVM flags to be passed to javac after the
|
unused_dependency_checker_mode |
Enable unused dependency checking (see Unused dependency checking).
Possible values are: |