开发者

How to handle Maven missing artifact errors?

I've just recently started doing Java development and I picked up Maven2 for dependency management and project task automation.

One peculiar issue I've stumbled upon, that I haven't been able to fully understand, is that for certain artifacts you need to configure exclusions for their dependencies, otherwise you get a Maven Missing artifact groupId:artifactId:version:lifecycle error. I've tried creating a Spring MVC project from the supplied STS Spri开发者_如何转开发ng project templates and the Maven POM contained exclusions for log4j, which, when removed, would produce an error.

So what do I do when I manually add a dependency and get the missing artifact error for some of it's dependencies. Do I just jump and add them to the list of exclusions or should I be more careful about it?

And why does this happen? I'm assuming it may be perhaps that an artifact has a dependency of a certain version and another artifact has the same dependency of a different version, where both can't exist on the classpath or is it something else I'm missing?


You would configure exclusions if that particular dependency is being supplied elsewhere, either explicitly in your POM, or by another dependency.

If I got an "artifact not found" message my first thought would not be to exclude it, but to find out where it's required, then add it in the relevant scope to my POM.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜