Maven Tutorial
Introduction to Maven Installation and environment configuration Maven settings Standard directory structure in Maven project command line IntelliJ IDEA Super POM and Parent POM Understanding POM.xml file Declaring maven dependencies Dependency management using repositories in Maven Adding jar file as a dependency in Maven Maven archetypes Maven build life cycle, phases and goals Generating project API documentation Generating Site documentation for a project Installing artifacts in local repository Deploying the artifact on remote repository Maven plug-ins surefire plugin compiler plugin Profiles in MavenExecuting Maven phases and goals through command prompt Maven command line optionsexec-maven-plugin usage Skipping tests in Maven Test execution report in MavenPOM file in Maven
Crux of the maven is POM.xml file. This file contains all important information about the project as mentioned below.- groupId – defines group
- packaging – type of artifact distributable file like jar, war, ear
- artifactId – defines name of the artifact
- version – defines version of the artifact
- dependencies – used to declare the dependencies for the project.
- properties – used to declare the variables within POM
- build – used to configure plugins
- plugins – contains plugin configuration
- profiles – used to define the profiles for the project
- organization
- licenses
- scm
- distributionManagement
- name
- description
- developers
- contributors
- mailingLists
- repositories
- pluginRepositories
- parent
- issueManagement
- dependencyManagement
- modules
- prerequisites
- url
- inceptionYear
- ciManagement
<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>
<name>My Junit</name>
<description>Junit testing framework</description>
<url>https://www.softpost.org</url>
<inceptionYear>2015</inceptionYear>
<organization>
<name>Softpost</name>
<url>https://www.softpost.org</url>
</organization>
<developers>
<developer>
<id>sagar</id>
<name>Sagar Salunke</name>
<email>[email protected]</email>
</developer>
</developers>
<groupId>junittests</groupId>
<artifactId>myjunit</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java8</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes><include>%regex[.*]</include></includes>
<excludedGroups>mycategories.SanityTests</excludedGroups>
</configuration>
</plugin>
</plugins>
</build>
</project>
Web development and Automation testing
solutions delivered!!