Last Updated on by
DevOps Maven-Explained
Apache Maven is one of the most extensively used build tool mainly for Java applications. It provides great assistance to the software developers throughout the project lifecycle.
Get to know about the DevOps process lifecycle & about the prominent DevOps tools through experts training by joining for DevOps Training In Hyderabad program by Kelly Technologies.
What Exactly Maven Do?
Maven helps the developers with
- Compilation of Source Code
- Running Tests (unit tests and functional tests)
- Packaging the results into JAR’s,WAR’s,RPM’s,etc..
- Upload the packages to remote repo’s (Nexus,Artifactory)
Some Prominent Aspects About Maven-
Now, let’s take a look at some of the prominent aspects about Maven
Maven Build Lifecycle-
There a set of conventions which Maven sets & follows. These conventions are flowed right from the very beginning of the project structure to building steps. Following these conventions in a project can get the build lifecycle done smoothly.
Speaking of the build lifecycle, there are three built-in steps namely ‘clean’, ‘default’ and ‘site’. A life cycle has multiple phases. To explain this let’s take the example of the ‘default’ lifecycle which exhibits the following phases
- Compile — Compiles The Source Code
- Test — Executes Unit Test Cases
- Package — Bundles The Compiled Code (Ex: War / Jar)
- Install — Stores The Built Package In Local Maven Repository
- Deploy — Store In Remote Repository For Sharing
Maven Repository-
In Maven, all the build artifacts (the dependent files & build outcome) gets stored in the Repository. Local and remote are the two different types of repositories in Maven.
Local Maven repository exists within the user’s system & is used for storing the copy of the dependent files, whereas the Remote maven repository is setup by a third party(nexus). It is used to permit access to access and distribute dependent files.
POM Example-
Mavens Project Object Model fundamental is its fundamental unit of work. It is an XML file which exists inside the directory of the project. The project builds configuration settings gets stored in POM.