
Converting a Project from Ant to Maven
Introduction
I recently wanted to convert a number of Java projects from the Ant build system to the Maven build system. Unless you are very familiar with Ant and Maven this is not a trivial task. On this page I describe how I approached the problem, and how I dealt with the inevitable bumps in the road.
Note that the project conversions in this document are pretty much one-on-one. If you have a larger Ant project, you should consider a more modular approach for the resulting Maven projects.
Be sure to keep the Ant documentation and Maven documentation handy!
Analysing the Ant Project
As an example Ant project we look at a loader for the UniProt protein database [license].
We analyze the first two levels of the directory structure with the tree -L 2 command:
~/ant_projects$ tree -L 2 . ├── uniprot-loader │ ├── build.xml │ ├── docs │ ├── etc │ ├── lib │ ├── src │ └── test └── utils ├── bin ├── src └── xsd 10 directories, 1 file
We have two directories, and the project we are after is called uniprot-loader. In the /uniprot-loader directory we see the Ant configuration file…