Now don't get me wrong. Ant is certainly a powerful and flexible tool and it wouldn't be used by countless Java projects if it was without any merit. However, GNU's make has been around a lot longer than Ant, and it:
- Is just as powerful if not more powerful. Make can execute any task available from the command line shell while Ant must specifically implement each task in a Java wrapper.
- Uses a more intuitive syntax for writing procedural code (namely a mashup of "make" syntax and shell syntax vs. XML)
Recently, though, I was faced with the task of revising our build system. Seeing as it was becoming more complex, with multiple independent modules forming a hierarchy of dependencies, I took the initiative to seek out potential alternatives to the Ant pain. I discovered Maven, and not a moment too soon. In my opinion, Maven is a next generation build tool and turns the entire concept of building Java software on its head. A few of the highlights:
- Like Ant, Maven uses XML. However, rather than coding the exact steps that you want the build process to execute, you code details about how your project is structured. (Using XML for structured data? Who would've thought?)
- Maven enforces a default directory structure in terms of where your source code, test code, and resource files live. When building a project, you don't need to worry about copying files around because Maven already knows where your files are and handles these tedious tasks for you.
- Maven uses a "single project, single artifact" convention. Each module in your overall project is setup as a separate Maven project that produces an individual artifact. Dependencies between modules are declared in the build files, and Maven automatically builds modules in the correct order, and includes their resulting artifacts in other modules' classpaths as necessary.
- Maven is configured to use external "Maven repositories" to resolve dependencies. This eliminates the need to store third party artifacts in your projects build tree as they can be automatically resolved and downloaded from the Maven repositories.
No comments :
Post a Comment