Build Automation #12 - Mavenizing your project - part 6
If you have worked on an ide like eclipse you might have already thought the structure created by Maven is different from how eclipse structures a project. If you directly import the maven created structure into eclipse you might see that eclipse identifies the project as disoriented and shows up compilation issues. No worries, there is a eclipse plugin for maven that comes to rescue. Issue the following command.
c:\helloworld\>mvn eclipse:eclipse
Eclipse workspace needs two important files that determines the project information and the classpath information. These information are stored in the files .project and .classpath respectively. The eclipse plugin modifies these files exactly what is needed in order for eclipse to understand the maven structure. Once you execute the above command, you can use eclipse to point to the directory to load the workspace. You can look at guide to using eclipse with maven for more information.
Maven helps in bringing discipline in the way the code is organized and structured and also helps in automating it. Suppose a new developer joins in the team, all you have to do is setup maven on the developer’s machine, pull down the current source that includes the pom from a version control system, apply the eclipse plugin and the developer is all set to start writing code. What’s more he/she can run maven to package it and deploy it locally and test it too. Thus everyone follows the automated process and the code and structure is standard across the team.
What we saw in this six part series on “Mavenizing your project” was a kick off to Maven. Maven can do a lot more stuff like site generation, code metric collection etc with the help of external plugins. Click here for a list of plugins available for Maven2.









