Sunday, October 26, 2008

maven

i am back to blog now after resting. This week, i am learning maven. A simply build tool to make easy developing your project. All of the capability that Ant has, is provided by maven with a simply way. In this blog, I will state steps that I have gone through (even not detail :P) to build a project using maven and building maven's plugin.

There are several terms that we need to understand about maven:

  • repository, maven installed in your machine has 2 repositories (by default). First is in your local, the second is in remote server (ibiblio). repository is used for storing third party plugins needed by your project.
  • lifecycle. Lifecycle in maven comprises several phases (by default). Take a look at this url. You can bound one or more task to certain phase as you like. You can also bound plugin task to any phases in maven's life cycle.

The first thing that you need to do is creating a maven's project. Execute the following command:

mvn -DgroupId=group -DartifactId= artifact

The above command will execute plugin which belongs to group and in artifact . You will see the plugin in your repository, take a look on your repository. If this is the first time you do a maven, maven should download the necessary file to your local repository.

The other interest thing about maven is the existent of plugin. Using plugin, you can customize maven's behavior. The purpose of having plugin is to have additional goal. The goal will be attached in certain lifecycle that has been defined in maven.