Standardizing Ant Build Scripts and the Birth of Maven: A Convention‑over‑Configuration Story
The article recounts how a developer observed repetitive Ant build scripts across projects, identified common build steps and path inconsistencies, proposed standardized directory conventions and XML‑based dependency declarations, leading to the creation of Maven and a shift toward convention‑over‑configuration in Java backend development.
Continuing from the previous article "Xiao Li's Build Journey (Part 1)", the author describes how Xiao Li's Ant build script became a de‑facto template that many colleagues repeatedly requested for new projects.
He noticed that almost every new Java project started with a copy of his original build.xml , revealing a common pattern in build processes.
The typical steps identified were:
1. Checkout code from version control. 2. Compile Java sources into a JAR. 3. Run unit tests. 4. Generate coverage and test reports. 5. Package a WAR file. 6. Deploy the WAR to a test server.
While the overall flow was similar, differences existed in file locations, class output paths, test report locations, and WAR placement, as well as varying third‑party JAR dependencies and inter‑project dependencies.
To address the inconsistency, the author proposes a unified directory convention and the use of a pom.xml file to declare project dependencies, similar to Maven's approach.
Example project layout (shown as code): +- pom.xml +- online-shop-web | +- pom.xml | +- src | +- main | +- webapp +- online-shop-api | +- pom.xml | +- src | +- main | +- java +- logging-framework | +- pom.xml | +- src | +- main | +- java +- app-config | +- pom.xml | +- src | +- main | +- java
By standardizing paths, tools can automatically locate source files, compile them, and run tests without manual configuration, dramatically simplifying build scripts.
The author also suggests maintaining a company‑wide repository of third‑party JARs (e.g., JUnit) so that developers can obtain all required libraries simply by importing a pom.xml , eliminating tedious manual copying.
This “convention over configuration” idea, inspired by Ruby on Rails, eventually led Xiao Li to create a new tool named Maven, distinct from Ant, which quickly gained adoption beyond his own company.
After a period of use, Xiao Li moved on to a new job, but Maven continued to spread as an open‑source solution for Java build automation.
(End of article)
DevOps
Share premium content and events on trends, applications, and practices in development efficiency, AI and related technologies. The IDCF International DevOps Coach Federation trains end‑to‑end development‑efficiency talent, linking high‑performance organizations and individuals to achieve excellence.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.