What is Maven?, Maven build process steps?, Maven environment steps?, and Advantages of Maven?
What is Maven?
Maven is a Java builds tool, and project management tool.
Using this build tool, we can automate build process steps for the java
project.
Build Process Steps:
- Setting required “.java” files into class path.
- Compiling “.java” files.
- Creating “.war” or “.jar” or “.ear” files.
- Deploying and un-deploying “.jar” or “.war” or “.ear” files.
- Starting and stopping the server.
- Generating Test reports and code coverage reports.
If we automate build steps for project then we can decreases
project development time and project cost as well. In addition to Maven we may
have one more build tool ANT, using ANT also we can automate build process
steps for the project. Maven is given by apache foundation and it is not license
version so that we can use this build tool in our project with free of cost.
Maven Environment Steps:
If we want to work with Maven, we need to download Maven
software from official site http://maven.apache.org/download.html,
here download latest maven version, Maven software is available for Linux and
Windows separately, and for Windows Maven software is available in a form of
.zip file with name apache-maven-x.y.z-bin.zip, Source code and API files are
available with the name of apache-maven-x.y.z-src.zip, so if you want to see
the source code of the Maven, you can download apache-maven-x.y.z-src.zip file.
After downloading Maven .zip file, extract somewhere in our
system. After extracting Maven software .zip file, you will get the below
folder structure.
After extracting Maven software you need to create three
environment variables. Before setting maven path variables, make sure Java path
variable and JAVA_HOME variables are sited or not. For running maven version
Java is required.
For setting variables right click on the Computer -> go
to properties -> Click on Advanced System Variables -> Click on
Environment Variables -> here in User variables Click new Button and add the
below variables
- MAVEN_HOME = {path_of_the_maven_sfotware}\apache-maven-3.3.9\
- M2_HOME = %MAVEN_HOME%
- Path = %MAVEN_HOME%\bin\
Here M2_HOME variable is the optional. If we set these
environment variables we can say that Maven software is installed successfully.
To verify Maven software is installed or not, Open command prompt and execute “mvn
–version” command from any of the location. Then you will get version of Maven
Software and Maven home location, java version, Java Home path location and OS
related information, See the below diagram.
Advantages of Maven:
As we know Maven is a build tool. In addition to that it
will create any type of java project that is Standalone project, Web Project,
Structs Project, Hibernate Project, Spring Project, etc…. And it will also
download required jar files for our project. If we wants to download required dependences
using maven, then developer needs to specify dependency information on the
pom.xml file of Maven Software. See the next post for pom.xml file
configuration and tags and how to add Maven dependencies.
What is Maven?, Maven build process steps?, Maven environment steps?, and Advantages of Maven?
Reviewed by Gurugubelli Technologies
on
January 08, 2017
Rating:
No comments: