Wednesday, June 8, 2011

Maven + MyEclipse the first view

For the first i tried my hands time on maven2. It is such a wonderful tool and using it with MyEclipse is such a charm.

It is so easy to setup a maven project on MyEclipse. All you need to do is to create a JavaMavenProject. Name is XXX(whatever you want your project to be named). I have named mine as hibernatemaven. It will create a directory structure like below.



Looking at POM.xml (heart and soul of maven), shows



i.e. by default maven takes JUNIT dependecy to the project

Maven uses declarative dependency i.e. Maven itself take care of finding and downloading the required jars of the particular dependency you mention in POM.xml. The dependency resolution is iterative, maven will search for child dependencies as well.

Now when i added following to POM.xml



and made build the project in MyEclipse. All the dependencies of hibernate were added to maven dependencies (mentioned in the directory structure).

One can find the dependency xml entry from mavenrepository.com as i found hibernate dependency entry from http://mvnrepository.com/artifact/org.hibernate/hibernate-core/3.6.4.Final

In additiion to above maven has it repository on your local machine bydefault it can be found at.{user_home}/.m2

All dependency jars are referred from there only.

On the whole my first experience with maven was nice, until next time.

No comments:

Post a Comment