2020-12-14

Maven artifact scope at runtime

 
Source URL: https://stackoverflow.com/a/12273576



runtime is useful for dependencies required for unit tests and at runtime, but not at compile time. This may typically be dynamically loaded code, such as JDBC drivers, which are not directly referenced in the program code.

Setting dependency to runtime ensure that there isn't an accidental dependency on the code, and also keeps the dependency from being transitive. So that, for example, if module A has a runtime dependency on library X, and module B depends on module A, it does not inherit the dependency on library X. Using "provided" or "compile" would cause B to depend on X.







No comments:

Google Referrals