This guide will discuss introducing Maven to an existing project which may have some other build system or none at all. It is assumed that you are now a little familiar with Maven, and have given it the Ten Minute Test, so have already created a simple project.
There is really only one step to introducing Maven into a project: the creation of the project descriptor. Since this does not affect your other build files and should be able to match your current layout, the process is the same as for starting a new project, however more of the values will be customised.
This approach can allow you to start getting some of the benefits of Maven without disturbing something that is already working.
However, eventually this will mean maintaining information in two locations, which is not ideal. Hopefully you will see that Maven offers the functionality of your existing build environment without much additional work and so will migrate towards using that as the sole platform.
For Ant users, there is a document called Migrating from Ant that will be of assistance.
No matter what you are using, the principles are similar: move small portions of your build to Maven, and make
Maven the central entry point for goals. For functionality remainining in the existing environment, Maven can
call out to it to perform those tasks, using <ant:ant/>
or <ant:exec/>
.
While Maven can usually be configured to match your environment, it is also important to consider refactoring your build, in the same way you would for your code. Changes small, known pieces at a time towards a layout that is encouraged by Maven's Conventions Reference.
If you need real-world examples, there are plenty of Maven powered projects that can be used as references. However, it is worth checking more than one and referring to the Best Practices document as you do this.