Question

I've been working with Maven for a little while now and I had a question about the information shown on the Maven Repository site. I was looking at the tags to paste into my pom for spring-web-mvc 3.2.8.RELEASE and noticed the table with the header "this artifact depends on" and saw the host of artifacts listed below.

My question is simple: Am I supposed to include the all of the dependencies listed in that table in my pom?

Was it helpful?

Solution

To answer your question, no you do not need to include all of the dependencies listed in the artifact dependencies section. It is my understanding that when you include a dependency in your pom file, maven will automatically download any needed jars. I am inferring this due to the fact that I personally don't add any of the artifact's dependencies other than what I need to my pom.

For example if I wanted spring-core I would do the following:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.2.8.RELEASE</version>
</dependency>

And maven will automatically take care of the dependencies for me.

A good way to test this out is to open a new maven project in eclipse and specify a dependency such as this, update the project, and then check in the Maven dependencies folder.

For fun, I experimented with this and it is indeed true, Maven will download any necessary dependencies when you update your project. After putting only the above dependency in my pom.xml file I got the following:

enter image description here

OTHER TIPS

No need to download all those. Maven will take care of all the artifact's dependencies for the specified dependency mentioned in pom file.

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