Dependencies are defined in the POM, and are resolved transitively. However, you don't need all dependencies in all situations. That is why dependecies can have a scope defined. Furthermore, there is a tag <optional>true</optional> you can use for a dependency.
The following scopes are supported:
- compile
- test
- runtime
- provided
- tag
<optional />
work in progress; please assist!
In the following table, we explain the behavior of each scope for different goals. We talk about the current project, the dependency and a user project. The current project is the project whose POM we are editing. The dependency is the project the user project directly depends on. A user project is a project for which the current project is a direct depency. Consequentially, a user project has an indirect depency on the dependency. We also presume a maven2-based mechanism (goal) to run final projects.
scope |
description |
|
|
{run} |
Unknown macro: {assembly} |
|---|---|---|---|---|---|
compile |
This dependency is needed for compilation, for testing, and at runtime |
Downloaded and use dependency in the classpath. A user project will also download and use the depency. |
Downloaded and use dependency in the classpath. A user project will also download and use the depency. |
Downloaded and use dependency in the classpath. A user project will also download and use the depency. |
? |
test |
This dependency is needed for testing the current project. It is not needed for compiling the main source or running the final product. |
dependency is not used |
Downloaded and use dependency in the classpath. A user project will also download and use the depency. A user project will not download or use the dependency. |
dependency is not used |
dependency is not used |
runtime |
This dependency is needed for running the current project. It is not needed for compiling the main source or compiling or running the tests. |
dependency is not used |
dependency is not used |
? |
|
provided |
? |
? |
? |
? |
|
optional |
? |
? |
? |
? |
<optional></optional>
