Friday, July 29, 2011

Introduction to Maven

Maven is a build tool which handles project dependencies and job automation. In most of my java and scala projects, I use Maven.


Especially in a team working environment, you need build tool like maven to synchronize version of modules and libraries between each developer workspace. So, one coder specifies what he needs for his module, commit the maven configuration file (pom.xml) to source code version control. Another developer pull down the latest pom.xml file from version control and then his local workspace knows that the module requires a new external library.


The next magic thing maven provided is the centralized library repository. So following the previous example, when the second developer builds the project, maven will automatically access the repository, which exists somewhere in the internet, and download the libraries. It saves everybody so much time to handle libraries versioning in each machine. There is a library search online: http://mvnrepository.com. Instruction to update your pom.xml is also included there.


Another magic thing you frequently use with maven is continuous integration. Maven handles dependencies and also able to run unit tests, packaging, deployment, code quality reporting, etc. So that developer can solely focus on coding instead of managing all those repeating mundane stuff.


Check out maven if you have never used it before. Google mvn archetype:generate, and then you will find some useful stuff to follow. Enjoy !

1 comment:

  1. you using java nowadays? or using maven with ruby/scala?

    ReplyDelete