Hi, Hope you are fit and fine. This post is focused on Apache Maven. Lets Start with introduction of Maven.
What is Apache Maven?
Apache Maven is a build or a total project management tool that scores over its predecessors such as ANT for Java builds with the following advantages:
Useful when multiple JAR files are required for builds
Resolving recursive dependencies during build time
Creating project structures that are standardized
Building, publishing, and deployment of applications
Supports lifecycle of an application along with plugins
Maven is a powerful project management tool that is based on POM (project object model). It is used for projects build, dependency and documentation.
The following are known as the maven coordinates (the ones that are the most important) for any project.
GroupId: The name with which we can refer groups of such projects. e.g.: alumni_project
ArtifactId: The name with which the JAR or WAR will be created. e.g.: alumni
Version: The version number of the current project
Package: The package of the resulting classes, usually under src\java. e.g.: me.sumithpuri.maven
The most important lifecycle stages or phases for a Maven project include the following.
Validate: Validates whether the project coordinates and pom.xml are valid, or else it generates errors.
Compile: Compiles the project and generates errors if it cannot be compiled.
Test: Unit tests the code and does not require that the code be packaged.
Package: Packages and generates the artifact, such as a JAR.
Install: Installs the generated artifact, such as a JAR in the local repository.
Maven works in the form of plugins and follows the general format as follows: mvn plugin:goal
Some of the plugins include JAR, compiler, and surefire. An example of a Maven command is as follows:
Maven Repository (Architecture)
Maven follows a two-repository model, wherein it maintains a local repository (which is created when you execute the first maven command). It downloads dependencies from the remote repository onto this local repository and then builds projects.
The Maven project is compiled; it checks in the local repository for dependencies.
If dependencies do not exist, Maven downloads them from the remote repository.
Once dependencies are downloaded, they are installed in the local repository.
Once all dependencies are met, Maven compiles the code and the project.
You can download Apache Maven as a zipped file, apache-maven-3.6.0-bin. zip, from the following address: https://maven.apache.org/download.cgi
After downloading it, just unzip the file to a directory, for example, c:\apache-maven-3.6.0\.
Once it is unzipped, you will find the Maven program, mvn.jar, in the bin subdirectory.
To test your Maven, just run the following command: mvn --version But you need to add c:\apache-maven-3.6.0\bin\ to your system PATH first, or simply run the Maven program with its full path. Either way, the result should show the version of Maven, the version of Java, and the information about your operating system,
Why Use Maven?
The key features of Maven are:
simple project setup that follows best practices: Maven tries to avoid as much configuration as possible, by supplying project templates (named archetypes)
dependency management: it includes automatic updating, downloading and validating the compatibility, as well as reporting the dependency closures (known also as transitive dependencies)
isolation between project dependencies and plugins: with Maven, project dependencies are retrieved from the dependency repositories while any plugin's dependencies are retrieved from the plugin repositories, resulting in fewer conflicts when plugins start to download additional dependencies
central repository system: project dependencies can be loaded from the local file system or public repositories, such as Maven Central
This is the Basics of Apache Maven.
How codersArts Help you in Maven ?
Maven Assignment Help
Error Resolving service in Maven Projects
Mentorship in Maven from Experts
If you are looking for any kind of help in Apache Maven , Contact us for instant help.