Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the responsive-lightbox domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114
POM.xml in Maven - Testingpool

POM.xml in Maven

In the previous post, we have seen how to create the Maven project and import that into eclipse.  In this post, we will learn about one important component of Maven that is nothing but POM.Xml.

POM.xml in Maven:

  • POM stands for “Project Object Model”, which is an important unit of work in Maven.
  • It is a XML file, which contains information about project and configuration details which is used by Maven to build the project.
  • It is created by default during creation of Maven project.
  • To download jars into project, we add them in form of dependency tags by defining its groupid, artifact id,version etc.
  • POM can also contain different goals and plugins to achieve some desired actions.
  • In Maven 1, POM was known as project.xml. It is renamed to POM in Maven 2.
  • POM resides in the current directory i.e. at project level.
  • POM may keep increasing in size as the project grows but it makes developers’ jobs easier to maintain complex projects.

Project is the root element in the POM and it has 3 major sub-nodes.

Name Descrition
groupId It is id or say package which exists in POM. IT is generally unique in the project. e.g. com.testing.Mobile
artifactId It is basically the project name.The artifactId defines the artifact’s location within the repository.
version It is the project version.It is used within an artifact’s repository to separate versions from each other. e.g. com.testing.Mobile : Model 1.0 and com.testing.Mobile : Model 1.1

Below, we have shown a POM.xml File, which is containing the dependency for testng which is having project name testng, groupid org.testng and version 6.3.1. We can define multiple dependencies under a single <dependencies> tag.

It is also having a plugin for sure-fire report which is defined under <build> tag. In <suiteXmlFiles>, we are providing the path for testng.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>

  <groupId>com.testing.Mobile</groupId>
  <artifactId>learningMaven</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>learningMaven</name>
  <url>http://maven.apache.org</url>

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

  <dependencies>
    <dependency>
 	 <groupId>org.testng</groupId>
  	 <artifactId>testng</artifactId>
  	 <version>6.3.1</version>
     <scope>test</scope>
    </dependency>
    
    <dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.4</version>
</dependency>
  </dependencies>
  
  <build>
 
        <plugins>    <!-- plugins in POM-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.18.1</version>
              <configuration>
		                 <suiteXmlFiles>
						    <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
						</suiteXmlFiles>
		                 <skip>true</skip>
		                    
		          <linkXRef>false</linkXRef>  
		      </configuration>
            </plugin>

            </plugins>
    </build>
   
</project>

Ask Question
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...

1 Response

  1. September 1, 2015

    […] the previous post, we have learnt about the pom.xml. In this post, we will create a project and execute it through maven […]