Apache Maven
Maven turns your human-readable Java code into executables that computers can run (a process called “building”). If you built your code manually (e.g. using a Unix/Linux makefile), you’d have to keep track of hundreds or thousands of steps and dependencies that might not be obvious. Maven takes care of all those complications in the background so you don’t have to.
Background
Programming languages like C, Java, and Python were created to make it easier for humans to write instructions that a computer could execute. But natively, the computer needs language it can understand. Depending upon the language you’re coding in, compilers (e.g. for C, C++) or interpreters (e.g. Python, R) are needed to perform that intermediate translation step.
For compiled code, this is a two-step process (the code you wrote gets compiled to an object file, and then a linker utility creates the executable machine code). For interpreted code, this is a one-step process (the code you wrote gets interpreted by runtime files).
Java is translated slightly differently. Because Java was designed to run across multiple platforms(*), requiring only the presence of a Java Virtual Machine (JVM)/Java Runtime Environment (JRE), the process goes like this:
- Write your code in Java (in .java files)
- Use your IDE (EclipseIDE, IntelliJ, or VsCode) to turn the entire project full of interrelated .java files into .class files using the javac program
- If you want to distribute and execute that code on any OS, bundle the .class files into an executable Java archive (.jar) file
You don’t need an IDE to go through this process, but particularly for Java, an IDE will make your life much easier. Back in the olden days, we used to write makefiles to specify exactly how all the 10s or 100s of files containing code should be compiled. They looked like this, and were typically a few hundred lines long. It often took as long to write the makefile as it did to write the code.
From https://stackoverflow.com/questions/2209827/why-is-no-one-using-make-for-java
The new approach is to set up your Java project using the standard Maven directory structure, store the configuration instructions for Maven in the pom.xml in the base area of that structure, and then (instead of spending hours building your code from source) -- just say “hey Maven, go build my code.”
* = Although Java was designed to be cross-platform, it’s not 100% there, especially if you are developing Java apps for mobile devices.
Additional Q&A
Additional Resources
--
NicoleRadziwill - 03 Apr 2020