Maven is a “build management framework”
You could define how your .java files get compiled to .class, packaged into .jar (or .war or .ear) files, (pre/post)processed with tools, managing your CLASSPATH, and all others sorts of tasks that are required to build your project.
Though it doesn’t give fine grain control like Apache Ant or Gradle or Makefiles in C/C++, but it attempts to be completely self-contained in it that you shouldn’t need any additional tools or scripts by incorporating other common tasks like downloading & installing necessary libraries etc.
It is also designed to around “build portability” so that you don’t get issues as having the same code with the same buildscript working on one computer but not on another one (this is a known issue, we have VMs of Windows 98 machines since we couldn’t get some of our Delphi applications compiling anywhere else). Because of this, it is also the best way to work on a project between people who use different IDEs since IDE-generated Ant scripts are hard to import into other IDEs, but all IDEs nowadays understand and support Maven.
There are few inflexibility in maven and some developers stick with Ant or similar, but a growing number of them are people who have moved on to Maven successors such as Gradle and Buildr. These successors inherit from Maven the idea of providing a powerful set of build steps out of the box, but make it immensely easier to add custom steps too.