• TestingDocs
TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Apache Maven

What is Maven?

Maven

Introduction

Apache Maven is a build automation tool. It is popularly used for build automation, dependency management, project life-cycle, continuous integration. One of the best features of Maven compared to the Ant tool, is that it will discover the dependency artifacts automatically.

Apache Maven is a tool for building software. It is configured with a POM (Project Object Model ) file. It runs in JVM and uses a distributed repository model. ( plugins and dependencies are kept in remote repositories ).

Installing Apache Maven

The only prerequisite for installing the tool is Java JDK. Installing maven is very easy, download and extract the tool into a folder and set the environment variable.

  • Download from the Official site: http://maven.apache.org/

Detailed information on how to set up Maven is at:

https://www.testingdocs.com/installing-apache-maven-3-x-on-windows-10/

Environment variables

Configuration of environment variables

  • JAVA_HOME: Points to installation location for the JDK installation.
  • M2_HOME: Points to the home directory for Maven
  • PATH: Unix appended the following to existing path  ${JAVA_HOME}/bin and ${M2_HOME}/bin
  • Windows appended the following to existing path   % JAVA_HOME%\bin and %M2_HOME%\bin

 

Project Object Model

The important file in the Maven project is pom.xml ( Project object Model ). Every project contains this file. POM is an XML file that contains information about project and configuration details used by Maven to build the project.

● The XML file pom.xml contains details about the project, dependencies
● POM may be hierarchical i.e it can have a parent POM and child POMs for a given project.
● Defines project identity, dependencies, plugins, repositories, parent POM, modules, properties, and many more.

 

Maven POM Editor

Creating a simple maven project via command line or through Eclipse/IntelliJ IDEA IDE.

I have created a sample project through the following command to show in the post. Generally, Choose the IDE to create a quick maven project.

/> mvn archetype:generate -DgroupId=com.testingdocs.sample  -DartifactId=SampleProject

Sample POM


<project xmlns=”http://maven.apache.org/POM/4.0.0” 
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” 
 xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd”> 
 <modelVersion>4.0.0</modelVersion> 
 <groupId>com.testingdocs.sample</groupId> 
 <artifactId>Sample</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>jar</packaging>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

 

Maven Tutorials on this website can be found at:
https://www.testingdocs.com/apache-maven-tutorial/

For more details on the Apache Maven, visit the official website at:
https://maven.apache.org/

Related Posts

Maven Download Verification Win11

Apache Maven /

Download Maven on Windows 11

Invalid Target Java Error

Apache Maven /

Fix Fatal Error compiling: Invalid target release in Maven Project

Maven Project from archetype

Apache Maven /

Create Maven Project from Archetype in NetBeans

Create New Project

Apache Maven /

Create a Maven Project skip archetype

Maven Download Button

Apache Maven /

Install Maven on Ubuntu Linux

‹ Install Apache Maven 3.x on Windows 10› Maven Build Lifecycle

Recent Posts

  • How to secure your SQL Database: Tips and Tricks
  • Shaping the Future of Development: Exploring Key Trends in Software Engineering
  • Improving Java Performance with Multithreading
  • Difference between PHP and JavaScript?
  • Bing Conversation Styles
  • ChatGPT Introduction
  • Open Source AI Frameworks
  • Artificial Intelligence Tools
  • Top AI Music Applications
  • Top AI Website Design Tools

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com