Sunday, July 1, 2007

Maven tutorial

Today, i will make a tut about maven.

Definition about maven:

Maven was originally started as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects each with their own Ant build files that were all slightly different and JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects.

The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

Home page: http://maven.apache.org/index.html

Step 1: Download maven from home page.

Step 2: configure setting.xml in folder maven/conf

Tag localRepository : is used to set the folder where maven will downloaded all library and find them when build project.

Tag Proxy: is used when you are behind the network proxy.

Step 3: Set up project layout.












After create the folder for our project. We have to create pom file for them.
At the folder project. We have a top pom file pom.xml.
At the folder modules, we also have a pom.xml file.
At module1, module2, we also have a pom.xml file.

Using tag modules and module to show which one will be compiled next.

[modules]
[module] modules [/module]
[/modules]

Using repository tag to show which repository maven used to get library:

[repositories]
[repository]

[/repository]
[/repositories]

Using dependency tag to show which library you used in the project.
[dependencies]
[dependency]
[/dependency]
[/dependencies]

1 comment:

Sandeep Kunwar said...

Hey can u plz tell something more on settings.xml on windows platform.
I am not sure whether i m using proxy or not, as in Internet connection settings in browser its mentioned as direct connection.
Any information will be highly appriciated, kindly use sandeep.kunwar at gmail.com
thanks

Google