Comparison
Here's a small matrix which should help you choosing the right instance.
In general:
- an Artifact holds a file mapped on a certain coordinate.
- a Dependency contains an artifact and has transitive information
- a MavenProject hold a pom-file and optional mainfile and can have attached (=classified) files, all using the same GAV.
|
Dependency |
Artifact |
MavenProject |
Has dependencies |
yes |
no |
yes |
filetype reference |
type |
file-extension |
packaging |
version ranges |
yes |
no |
no |
attached artifacts |
no |
no |
yes |
This implies the following:
- From dependency to artifact is possible, since you can map a type to an extension. However, it is not possible to go from artifact back to dependency, there are several types which have jar as file extension.
- There's no such thing as transitive artifacts. Filtering during resolution as based on DependencyFilters, ArtifactFilters can only be applied afterwards, hence are less efficient.