POM 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
Here is the sample POM.xml file.
 
<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!!