Apache Ant vs Bazel
When comparing Apache Ant vs Bazel, the Slant community recommends Bazel for most people. In the question“What are the best general purpose build systems?” Bazel is ranked 4th while Apache Ant is ranked 12th. The most important reason people chose Bazel is:
Builds only use input files that are explicitly declared in the build specification. On Linux, Bazel runs tools in a sandboxed environment that contain only the minimum necessary files required.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Agile Dependency Manager (Ivy)
Ivy is a powerful tool for managing dependencies. It's highly configurable and very flexible and is not tied to any specific structure or architecture.
Although it can also be used as a standalone tool, it's tightly integrated with Ant and provides all the dependency management services for it, basically transferring all of Ivy's flexibility in dependency management to Ant as well.
Pro Good for special projects
Ant is an imperative build system, this means that it's very good at controlling the build process. You "tell" Ant what to do during the whole process, for example: "compile these files and put them in that folder". This is great for special projects where you want as much control as possible during the build process.
Pro Correct and repeatable builds
Builds only use input files that are explicitly declared in the build specification. On Linux, Bazel runs tools in a sandboxed environment that contain only the minimum necessary files required.
Pro Fast even at scale
Even at large scale it's pretty fast (it's based on what Google uses internally for their huge code base).
Pro Can rule shell commands
Pro Handles mixed language builds
Pro High level build descriptions
Pro Build rule errors are informative
When builds fail because of an issue in the build rules, the errors provided are usually very informative and helpful to resolve the issue.
Pro Good IDE support
Pro Standard protocol for remote execution and caching
Pro Remote execution of commands
Cons
Con Too much freedom
While it's true that Ant gives you a lot of freedom and control over your builds, it also means that you will have to constantly reinvent the wheel on how your project structure and how everything fits together for every new project. This also makes it harder for other people to simply start working on your project because of the wide range of different ways to build a project with Ant. While tools that have more constraints generally end up looking the same and it's easier to understand how everything fits.
Con Draconian sandboxing, explicit inputs requirement
Requirement to explicitly name all inputs disqualifies Bazel for many workflows, e.g. those relying on tools that scan a directory tree themselves looking for files to process. Sandboxing as implemented in Bazel imposes further restrictions. If a command is successful when you type it in the shell, it should also be successful when pasted verbatim into a rule, but with Bazel it very often isn't.
Con Confusing for beginners
With so many capabilities, trying to implement with a simple project is overkill and unpleasant.
