Maven: What is the purpose of the "runtime"?

Possible duplicate:
Understanding Compile-Time Runtime Values

I understand that a dependency with the "runtime" scope will be available at runtime, not at compile time. But I don’t understand why you want it! Why not just use the compilation area?

docs really don't help. Any idea?

+69
maven
Sep 04 '12 at 23:05
source share
1 answer

runtime is useful for dependencies needed for unit tests and at runtime, but not at compile time. This can usually be dynamically loaded code, such as JDBC drivers, which are not directly referenced by the program code.

Establishing a dependency on runtime ensures that there is no random code dependency, and also delays the dependence on transitivity. So, for example, if module A has a runtime dependency on library X, and module B depends on module A, it does not inherit dependency on library X. Using "provided" or "compilation" will cause B to depend on X .

+80
Sep 05
source share



All Articles