Exploring the POM

Open pom.xml in the editor and go to the pom.xml tab. The file should have the following content:

<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>packt.book.jee_eclipse</groupId> <artifactId>maven_jsf_web_app</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>maven_jsf_web_app Maven Webapp</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>maven_jsf_web_app</finalName> </build> </project>

Let's have a look at the different tags in detail, that are used in the preceding code snippet:

  • modelVersion: This in the pom.xml file is the version of Maven.
  • groupId: This is the common ID used in the business unit or organization under which projects are grouped together. Although it is not necessary to use the package structure format for group ID, it is generally used.
  • artifactId: This is the project name.
  • version: This is version number of the project. Version numbers are important when specifying dependencies. You can have multiple versions of a project, and you can specify different version dependencies in different projects. Maven also appends the version number to JAR, WAR, or EAR files that it creates for the project.
  • packaging: This tells Maven what kind of final output we want when the project is built. In this book, we will be using JAR, WAR, and EAR packaging types, although more types exist.
  • name: This is actually the name of the project, but Eclipse shows artifactid as the project name in Project Explorer.
  • url: This is the URL of your project if you are hosting the project information on the web. The default is Maven's URL.
  • dependencies: This section is where we specify the libraries (or other Maven artifacts) that the project depends on. The archetype that we selected for this project has added the default dependency of JUnit to our project. We will learn more about JUnit in Chapter 5, Unit Testing.
  • finalName: This tag in the build tag indicates the name of the output file (JAR, WAR, or EAR) that Maven generates for your project.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.244.217