pushya
pushya

Reputation: 4418

how to configure dependencies in maven pom.xml?

I am converting my simple working web application (runs from eclipse) to a maven project. This is my first maven project. I have 3 external jar dependencies to it and i added then to the pom.xml my build is failing saying that it can't find those 3 dependencies. here my pom.xml file

enter image description here The build is saying that the 3 packages does not exist.

package javax.servlet does not exist
package org.apache.commons.codec.binary does not exist
package org.apache.commons.configuration does not exist

What i am missing? I am running my application from Mac and in the .m2/repository i see these 3 libraries/packages present.

Upvotes: 1

Views: 3365

Answers (2)

Jonathan
Jonathan

Reputation: 20375

You need to either remove the dependencyManagement tags that surround dependencies or add the dependencies again but nested within the project tag, i.e. at the same level as dependencyManagement.

dependencyManagement allows you to fix information about dependencies across a multi-module project - e.g. like version numbers - however you still need to provide a dependencies section alongside that so that Maven knows to include them.

If your project is not a multi-module project I would be tempted to not use a dependencyManagement section at all.

Upvotes: 5

Eugene Ryzhikov
Eugene Ryzhikov

Reputation: 17359

Just remove dependecyManagement tags

Upvotes: 2

Related Questions