I donโt know any effective automated way of migration, because things can be too different, so I will do it manually, step by step, and keep the existing ant construction parallel to the future new one until all migration has been carried out (both technical and human points of view).
First reorganize your existing ant construct to align it with Maven conventions:
- Make things modular: if your existing assembly is a large monolithic assembly that produces several artifacts from the same source tree, break it into separate modules, one for each artifact.
- Refresh the directory structure: Maven comes with a standard catalog layout and, although you can customize this (i.e. to configure plugins for a different layout), this is not recommended and is more a source of problems than advantages. So I would move the existing application sources, configuration files, tests, etc., to fit the Maven layout (e.g.
src/main/java for application sources, etc.).
Then start creating the Maven assembly:
- Create POM for each module: Create POM, declare external libraries as Maven dependencies (perhaps add them to the corporate repository, using the corporate repository is good practice in the enterprise context) add dependencies between the modules.
- Complete the assembly of several modules: Add parent POMs and inheritance / aggregation relationships. Check for regression with artifacts created.
You can do this work in a separate VCS branch if you don't want to change anything until the work is done, and create scripts to move things around. And when you are ready, combine certain Maven stuff and apply the scripts.
source share