Question

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 Spring 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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top