I am confused about the difference between the
artifactItem defined in
maven-dependency-plugin and the
dependency defined in
dependencies in maven.
My real question is why do you put
artifactItems while you can put the
Is it because that you can specify copy/pack the dependency to a specified folder using maven-dependency-plugin? If so, does it means that maven-dependency-plugin is a superset of dependencyManagement? If true, why bother to have dependencyManagement?
To make it simple, let’s not consider multiple projects. Let’s assume that there is only one project and one pom, it doesn’t have any child project.
artifactItem of the
maven-dependency-plugin only applies to that specific step (e.g. unpacking that dependency or copying it somewhere). In
dependencyManagement you can specify artifact versions etc., so that you can include them in submodules just by group and artifact id in the
dependencies section, while the version is only configured in the
dependencyManagement block. So technically, those 3 configuration ways (
dependencies all serve their own purposes, neither is a superset or subset of another one.