How to manage project dependencies using Maven?
First of all check if the maven is installed - mvn --version
in the command line.
If not - follow the guide - http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
To create a pom.xml
manually is not a good point if you use IDE - just create a new Maven project (for example in Idea or Eclipse). This way you will avoid errors with some required configurational tags missing. Then add the needed dependency in the dependencies
tag in pom.xml
Actually, one of the best tutorials about maven is http://www.mkyong.com/tutorials/maven-tutorials/ - there are a lot of topics. Choose the desired one.
If you use Eclipse IDE
just follow this tutorial to convert your project to the Maven project - Convert Existing Eclipse Project to Maven Project - and delete the pom.xml
created by you before that. Be sure to have the m2eclipse
plugin installed in the IDE.
This is for the conversion in the Intellij idea
- IntelliJ - Convert a Java project/module into a Maven project/module