Home Interview Questions and Answers Maven Interview Questions and Answers For Freshers Part-5

maven41.What is the minimal set of information for matching a dependency references against a dependencyManagement section ?
{groupId,artifactId,type,classifier}.

42.How do you reference a property defined in your pom.xml file?
To reference a property defined in your pom.xml, the property name uses the names of the XML elements that define the value, with “pom” being allowed as an alias for the project (root) element.

So ${pom.name} refers to the name of the project, ${pom.version} refers to the version of the project, ${pom.build.finalName} refers to the final name of the file created when the built project is packaged, etc.

43.What are the default values for packaging element? If there is no packaging element defined? What is the default value for that?
Some of the valid packaging values are jar, war, ear and pom. If no packaging value has been specified, it will default to jar.

44.What is the value for packaging element in pom for a project that is purely meta-data?
pom

45.What is the use of execution element in pom file?
The <execution> element contains information’s required for the execution of a plugin.

46.What is a project’s fully qualified artifact name?
<groupId>:<artifactId>:<version>

If you do not define any information, where does your pom inherits that information from?
All POMs inherit from a parent (despite explicitly defined or not). This base POM is known as the Super POM, and contains values inherited by default.

47.How profiles are specified in Maven?
Profiles are specified using a subset of the elements available in the POM itself.

48.What are the elements in POM that a profile can modify when specified in the POM?
<repositories>, <pluginRepositories>,<dependencies>, <plugins> ,<properties>, <modules><reporting>,<dependencyManagement>,<distributionManagement>

49.Why profile is used in Maven?
To give portability to projects ( e.g. windows, linux etc).

50.What are the benefit of storing JARS/external dependencies in local repository instead of remote one?
It uses less storage, it makes checking out project quicker, non need for versioning JAR files.

You may also like

Leave a Comment