Maven (Build Management tool)

What is Maven?

•Maven is a powerful project management tool that is based on POM (project object model).

•It is used for project build, dependency, and documentation.

•It simplifies the build process like ANT. But it is too much advanced than ANT.

  • In short terms we can tell maven is a tool that can be used for building and managing any Java-based project. maven make the day-to-day work of Java developers easier and generally help with the comprehension of any Java-based project.

What maven does?

Maven does a lot of helpful tasks like

•We can easily build a project using maven.

•We can add jars and other dependencies of the project easily using the help of maven.

•Maven provides project information (log document, dependency list, unit test reports, etc.)

•Maven is very helpful for a project while updating the central repository of JARs and other dependencies.

•With the help of Maven we can build any number of projects into output types like the JAR, WAR, etc. without doing any scripting.

  • Using maven we can easily integrate our project with a source control system (such as Subversion or Git).

Maven Build Lifecycle:

Default lifecycle:

Default->Clean -> site ->

Maven Lifecycle Phases

•clean

•Validate

•Compile

•Test

•Package

•Integration Test

•verify

•Install

•Site

•deploy

•validate — validate the project is correct and all necessary information is available

•compile — compile the source code of the project

•test — test the compiled source code using a suitable unit testing framework. These tests should not require the code to be packaged or deployed

•package — take the compiled code and package it in its distributable format, such as a JAR.

•Integration test: It runs the integration tests for the project.

•verify — run any checks on results of integration tests to ensure quality criteria are met

•install — install the package into the local repository, for use as a dependency in other projects locally

  • deploy — done in the built environment, copies the final package to the remote repository for sharing with other developers and projects.

Maven Plugins:

Clean Clean up after the build.

compiler Compiles Java sources.

deploy Deploy the built artifact to the remote repository.

failsafe Run the JUnit integration tests in an isolated class loader.

install Install the built artifact into the local repository.

resources Copy the resources to the output directory for including in the JAR.

site Generate a site for the current project.

surefire Run the JUnit unit tests in an isolated class loader.

verifier Useful for integration tests — verifies the existence of certain conditions.

Basic Maven Commands:

•mvn clean: Cleans the project and removes all files generated by the previous build.

•mvn compile: Compiles source code of the project.

•mvn test-compile: Compiles the test source code.

•mvn test: Runs tests for the project.

•mvn package: Creates JAR or WAR file for the project to convert it into a distributable format.

•mvn install: Deploys the packaged JAR/ WAR file to the local repository.

  • mvn deploy: Copies the packaged JAR/ WAR file to the remote repository after compiling, running tests, and building the project

Author:

Codeless Conf 2022: Register below

Blogger of the month program: Register below

--

--

--

Welcome to QA Talks, a community-based startup that's mainly focused on QA blogs & talks — https://www.tech-talks.info/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Agile Software Development Methods: What is the Agile Unified Process?

Having beer with OOP and FP

Advent of Code 2021 — Day 8

Dear NFT enthusiasts, can you please give some opinion on following issues with NFT

How to Run Any Machine Learning GitHub Project Inside Google Colab

Hack The Box — Doctor Writeup

Annotation Tool Part 2: Retrospective on the Build

Bootstrapping a remote ad hoc team

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
QA Talks Community

QA Talks Community

Welcome to QA Talks, a community-based startup that's mainly focused on QA blogs & talks — https://www.tech-talks.info/

More from Medium

How To Handle Dynamic Dropdown In Selenium Webdriver

Data-Driven Testing With TestNG 💻

SelectorsHub — an awesome XPath and CSS Plugin

Test Automation Framework (Selenium with Java) — Minority Report or Allure in Action