Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page is started because I (the first author) don't understand the dependency scope mechanism. In the first version of this page, I am trying to make sense of different sources about the topic. This means the information here is not correct per definition! The intention of this page is to get it correct and clear, so please, if you do know something about dependency scopes, change the nonsense below (wink).

Introduction to the Dependency Mechanism

...

  • compile: This dependency is needed for compilation of the main source
  • test: This dependency is needed for compiling and running tests. It is not needed for compiling the main source or running the final artifact.
  • runtime: This dependency is needed for running the final artifact. It is not needed for compiling the main source or compiling or running the tests.
  • provided: ??This dependency is needed for compiling and/or running the artifact but is not necessary to include in the package, because it is provided by the runtime environment - for example, jsp-api.jar is provided by your web application container, so you don't include it in your WEB-INF/lib (for the example of a webapp).
  • tag <optional />

Legend:

  • U: Download and use dependency in the classpath. / Dowload and include dependency in the assembly.
  • U!O: Download and use dependency in the classpath, unless the dependency is <optional />. / Dowload and include dependency in the assembly, unless the dependency is <optional />.
  • !: dependency is not used

...