mvn dependency plugin requires jars to be installed?
When running mvn dependency:copy-dependencies in a multi-module project it seems that mvn expects the jars to be already installed in .m2/repo. Maybe I'm missing something but I can't figure out the sense in it...
This question is somewhat similar to Maven: Why does it need dependency modules' .jars for `mvn initialize`? but it's more specific to the dependency plugin (I guess...) and the mentioned question doesn't have a good answer, at least none that helps me...I have a multi-model project in which modA de开发者_StackOverflowpends on modB
Now I want to runmvn dependency:copy-dependencies -am -pl modA
This should copy all the dependencies of modA and all modules it depends on, e.g, also of modB
The problem is that if .m2/repo does not contain the jar of modB then the plugin fails... why?
Funny, if I just create an empty "jar" file at .m2/repo/ in the proper place, it's enough for the plugin to succeed so this just proves me that it doesn't even look at the contents of the jar, but it still requires it to be in place. WTF?...First question - why?
Second question - how do I bypass the problem without having to really generate the jars or "touch" them? (I have many and it's not practical...)Update: OMG, I just realized I forgot to add a valuable piece... I don't want modB to be copied so I actually excluded its artifact ID from the command, so it was actually:
mvn dependency:copy-dependencies -am -pl modA -DexcludeGroupIds=mod.b.group.id
I even tried:
mvn dependency:copy-dependencies -am -pl modA -DexcludeArtifactIds=modB
So if I hadn't done that then it totatlly makes sense that the plugin would look for modB in the repo but since modB is excluded then I expected the plugin to not require the modB.jar to be present.
Oh well, maybe this question just needs to be a bug report...Why? I guess that is what the command is supposed to do - copy dependencies and fail if they do not exist. The plugin is not concerned with the integrity of the artifacts.
One way to bypass this for selected groups/projects would be by using the excludeGroupIds
and excludeArtifactIds
parameters of the plugin.
精彩评论