官术网_书友最值得收藏!

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.
主站蜘蛛池模板: 万山特区| 塘沽区| 黄冈市| 吉安县| 敦化市| 宁德市| 梓潼县| 英德市| 日喀则市| 贵南县| 聂拉木县| 伊川县| 辉南县| 长春市| 陆良县| 诸暨市| 寿阳县| 河池市| 凉山| 台山市| 都昌县| 永川市| 会同县| 闻喜县| 新巴尔虎右旗| 西宁市| 雷山县| 天长市| 瑞丽市| 郎溪县| 弋阳县| 垫江县| 洛川县| 大同县| 星子县| 黄浦区| 庆云县| 耿马| 盐城市| 彭泽县| 东乌珠穆沁旗|