Which section of the pom.xml
file is used to define project information such as the name, description, and version?
A)
<modelVersion>
B)
<project>
C)
<groupId>
D)
<parent>
Answer:
B)
<project>
Explanation:
The <project>
section of the pom.xml
file contains the project’s metadata, including the name, description, version, group ID, and artifact ID. This section provides essential information about the project to Maven and other tools.
For example:
<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.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<name>My App</name>
<description>A simple Maven project</description>
</project>
In this example, the <project>
section includes the group ID, artifact ID, version, name, and description of the project.