Apache Ant has served us since the company’s founding. Every project had its own build.xml, carefully maintained by hand, with dozens of targets. With fifteen active projects and six developers it became unmanageable. A new person would spend their entire first day just understanding the build process.
Why Maven and not Gradle?¶
Gradle exists in 2011, but it is relatively young and almost nobody uses it in the enterprise Java world. Maven 3 is stable, has a huge plugin ecosystem and most IDEs support it out of the box. Convention over configuration is exactly what we need. The standard directory structure (src/main/java, src/test/java) means every developer immediately knows where to find things.
Migration strategy¶
Migrating all fifteen projects at once would have been madness. We chose a gradual approach: first the company Nexus repository, then shared libraries, smaller projects and finally the large multi-module projects. The entire migration took three months.
Nexus as the company repository¶
Nexus OSS is the foundation of the entire ecosystem. It acts as a proxy for Maven Central, hosts our internal artifacts and enables staging for the release process. The configuration proxies Maven Central, the JBoss repository and the Oracle Maven repository for JDBC drivers.
The biggest problems¶
Transitive dependencies. When you add one dependency, Maven automatically downloads all of its dependencies. Result? A WAR file with 200 JARs, some of which conflict. Solution: mvn dependency:tree and liberal use of exclusions. We created a company parent POM with a dependencyManagement section.
Oracle JDBC driver. ojdbc6.jar is not in Maven Central due to licensing restrictions. We had to upload it manually to Nexus.
Multi-module projects¶
Our largest application had in Ant a single enormous build.xml with 2000 lines. In Maven we split it into modules: core, persistence, service, web, ear. Building the entire project: mvn clean package. Seven minutes including tests. With Ant it was fifteen minutes.
Conclusion¶
Migrating from Ant to Maven is an investment that pays off within months. A standardized build process, automatic dependency management and integration with the CI server dramatically accelerated our development cycle.
Need help with implementation?
Our experts can help with design, implementation, and operations. From architecture to production.
Contact us