Maven tutorial for beginners


Introduction to maven

1. Maven is a build automation tool for Java projects (build tool means compiles the code, generate the document, packaging to one component jar or war or ear, build and deploy into the server.
2. Maven is a project management and comprehension tool.
3. Using maven we can build and deploy the applications into the server.
4.Using maven generating the documents for java projects.
5. In apache ant, some disadvantages are there so maven comes into existence to rectify all the disadvantages, in Apache and we can manually add jar files but in maven, all the dependency are added in pom.xml file based on the XML file all jar file is downloaded automatically.
ApacheMaven

Problems without maven

In Ant, we can set the environment manually like below.
1. Add the jar files externally to every project.
2. Create the right project structure.
3. Build and deploy the project.

Note: With Maven, we can avoid all these manual operations. just add the relevant dependencies and build and deploy the project with a single click.

What it repository and type of repositories in maven

It is a storage location from which software packages may be retrieved and installed on a computer.
  • Local repository
  • Central repository
  • Remote repository
Local repository: local repository is located on your local machine. it is created by maven when you run the application.
It's located on .m2 folder in your c drive.
Central repository: It's located on the web .it's created by maven community.
Remote repository: It's located on the web, most of the libraries missing in a central repository like db2 (it depend on another repository) .we need to add the repositories on pom.xml with dependencies.

In maven projects everything written on pom.xml file.
pom means project object model .in pom.xml contains project information like (name, version, package,) and configurations.

Elements on pom.xml file.

Project: Root element of pom.xml.
version:  a version of the project.
artifactId: Project name
groupId: It refers to the package.

Plugins:

Maven plugins are divided into two types those are 
  • Build plugins
  • Reporting plugins
Build plugins are executed at the time of build. These are used in inside of <build> tag.
Reporting plugins are executed at the time of site generation. These are used in inside of <Reposting> tag.

Creating the java stand-alone project with command prompt using maven click here 
Creating the java web application with command prompt using maven click here 

SUBSCRIBE TO OUR NEWSLETTER

I’m the Founder of quickdevops.com. I am a Professional Blogger, Application developer, YouTuber. I’ve been blogging since 2015.I spend a lot of time learning new techniques and actively help other people learn web development through a variety of help groups and writing web development tutorials for my website and blog about advancements in web design and development.Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie or planning a trip to someplace I've never been before.

0 Response to "Maven tutorial for beginners"

Post a Comment