Maven Interview Questions And Answers

Maven Interview Questions list for experienced

  1. Explain what is Maven? How does it work?
  2. List out what are the aspects does Maven Manages?
  3. Mention the three build lifecycle of Maven?
  4. Explain what is POM?
  5. Explain what is Maven artifact?
  6. Explain what is Maven Repository? What are their types?
  7. Why Maven Plugins are used?
  8. List out the dependency scope in Maven?
  9. Mention how profiles are specified in Maven?
  10. Explain how you can exclude dependency?
  11. Mention the difference between Apache Ant and Maven?
  12. In Maven what are the two setting files called and what are their location?
  13. List out what are the build phases in Maven?
  14. List out the build, source and test source directory for POM in Maven?
  15. Where do you find the class files when you compile a Maven project?
  16. Explain what would the "jar: jar" goal do?
  17. List out what are the Maven's order of inheritance?
  18. For POM what are the minimum required elements?
  19. Explain how you can produce execution debug output or error messages?
  20. Explain how to run test classes in Maven?
  21. What does it mean when you say Maven uses Convention over Configuration?
  22. What are the aspects Maven manages?
  23. How do you know the version of mvn you are using?
  24. What information does POM contain?
  25. What is Maven Build Lifecycle?
  26. Name the 3 build lifecycle of Maven.
  27. What is the command to quickly build your Maven site?
  28. What would the command mvn clean do ?
  29. What is a goal in Maven terminology?
  30. What would this command do mvn clean dependency:copy-dependencies package?
  31. What phases does a Clean Lifecycle consist?
  32. What phases does a Site Lifecycle consist?
  33. What is Build Profile?
  34. What are different types of Build Profiles?
  35. How can you activate profiles?
  36. What is a Maven Repository?
  37. What types of Maven repository?
  38. What is local repository?
  39. What is the default location for your local repository?
  40. What is the command to install JAR file in local repository?
  41. What is Central Repository?
  42. What is Remote Repository?
  43. What is the sequence in which Maven searches for dependency libraries?
  44. Why are Maven Plugins used?
  45. What are the types of Maven Plugins?
  46. When does Maven use External Dependency concept?
  47. What are the things you need to define for each external dependency?
  48. What is Archetype?
  49. What is the command to create a new project based on an archtype?
  50. What is SNAPSHOT in Maven?
  51. What is difference between Snapshot and Version?

Maven interview questions and answers on advance and basic Maven with example so this page for both freshers and experienced condidate. Fill the form below we will send the all interview questions on Maven also add your Questions if any you have to ask and for apply in Maven Tutorials and Training course just send a mail on info@pcds.co.in in detail about your self.

Top Maven interview questions and answers for freshers and experienced

What is Maven ?

Answer : Apache Maven is a software project management and comprehension tool. This tag is for questions that don\'t relate to a specific Maven version.

Questions : 1 :: Explain what is Maven? How does it work?

Maven is a project management tool. It provides the developer a complete build lifecycle framework. On executing Maven commands, it will look for POM file in Maven; it will run the command on the...View answers

Questions : 2 :: List out what are the aspects does Maven Manages?

Maven handles following activities of a developer • Build • Documentation • Reporting • Dependencies • SCMs • Releases • Distribution • Mailing...View answers

Questions : 3 :: Mention the three build lifecycle of Maven?


Clean: Cleans up artifacts that are created by prior builds • Default (build): Used to create the application • Site: For the project generates site documentation

Questions : 4 :: Explain what is POM?

In Maven, POM (Project Object Model) is the fundamental unit of work. It is an XML file which holds the information about the project and configuration details used to build a project by Maven.

Questions : 5 :: Explain what is Maven artifact?

Usually an artifact is a JAR file which gets arrayed to a Maven repository. One or more artifacts a maven build produces such as compiled JAR and a sources JAR. Each artifact includes a group ID, an...View answers

Questions : 6 :: Explain what is Maven Repository? What are their types?


A Maven repository is a location where all the project jars, library jars, plugins or any other particular project related artifacts are stored and can be easily used by Maven. Their types are...View answers

Questions : 7 :: Why Maven Plugins are used?

Maven plugins are used to • Create a jar file • Create war file • Compile code files • Unit testing of code • Documenting projects •...View answers

Questions : 8 :: List out the dependency scope in Maven?

The various dependency scope used in Maven are: • Compile: It is the default scope, and it indicates what dependency is available in the classpath of the project • Provided: It indicates...View answers

Questions : 9 :: Mention how profiles are specified in Maven?


Profiles are specified in Maven by using a subset of the elements existing in the POM itself.

Questions : 10 :: Explain how you can exclude dependency?

By using the exclusion element, dependency can be excluded

Questions : 11 :: Mention the difference between Apache Ant and Maven?

Apache Ant Maven • Ant is a toolbox – Maven is a framework • Ant does not have formal conventions like project directory structure – Maven has conventions...View answers

Questions : 12 :: In Maven what are the two setting files called and what are their location?

In Maven, the setting files are called settings.xml, and the two setting files are located at • Maven installation directory: $M2_Home/conf/settings.xml • User’s home directory: ${...View answers

Questions : 13 :: List out what are the build phases in Maven?

Build phases in Maven are • Validate • Compile • Test • Package • Install • Deploy

Questions : 14 :: List out the build, source and test source directory for POM in Maven?

Build = Target • Source = src/main/java • Test = src/main/test

Questions : 15 :: Where do you find the class files when you compile a Maven project?

You will find the class files ${basedir}/target/classes/.

Questions : 16 :: Explain what would the "jar: jar" goal do?

jar: jar will not recompile sources; it will imply just create a JAR from the target/classes directory considering that everything else has been done

Questions : 17 :: List out what are the Maven's order of inheritance?

The maven’s order of inheritance is • Parent Pom • Project Pom • Settings • CLI parameters

Questions : 18 :: For POM what are the minimum required elements?

The minimum required elements for POM are project root, modelVersion, groupID, artifactID and version

Questions : 19 :: Explain how you can produce execution debug output or error messages?

To produce execution debug output you could call Maven with X parameter or e parameter

Questions : 20 :: Explain how to run test classes in Maven?

To run test classes in Maven, you need surefire plugin, check and configure your settings in setting.xml and pom.xml for a property named...View answers

Questions : 21 :: What does it mean when you say Maven uses Convention over Configuration?

Maven uses Convention over Configuration which means developers are not required to create build process themselves. Developers do not have to mention each and every configuration details.

Questions : 22 :: What are the aspects Maven manages?

Maven provides developers ways to manage following: Builds Documentation Reporting Dependencies SCMs Releases Distribution mailing...View answers

Questions : 23 :: How do you know the version of mvn you are using?

Type the following command: mvn --version

Questions : 24 :: What information does POM contain?

POM contains the some of the following configuration information: project dependencies plugins goals build profiles project version developers mailing...View answers

Questions : 25 :: What is Maven Build Lifecycle?

A Build Lifecycle is a well defined sequence of phases which define the order in which the goals are to be executed. Here phase represents a stage in life cycle.

Questions : 26 :: Name the 3 build lifecycle of Maven.

The three build lifecycles are: clean:cleans up artifacts created by prior builds. default (or build):This is used to build the application. site: generates site documentation for the...View answers

Questions : 27 :: What is the command to quickly build your Maven site?

Type the command: mvn site

Questions : 28 :: What would the command mvn clean do ?

This command removes the target directory with all the build data before starting the build process.

Questions : 29 :: What is a goal in Maven terminology?

A goal represents a specific task which contributes to the building and managing of a project. It may be bound to zero or more build phases. A goal not bound to any build phase could be executed...View answers

Questions : 30 :: What would this command do mvn clean dependency:copy-dependencies package?

This command will clean the project, copy the dependencies and package the project (executing all phases up to package).

Questions : 31 :: What phases does a Clean Lifecycle consist?

The clean lifecycle consists of the following phases: pre-clean clean post-clean

Questions : 32 :: What phases does a Site Lifecycle consist?

The phases in Site Lifecycle are: pre-site site post-site site-deploy

Questions : 33 :: What is Build Profile?

A Build profile is a set of configuration values which can be used to set or override default values of Maven build. Using a build profile, you can customize build for different environments such as...View answers

Questions : 34 :: What are different types of Build Profiles?

Build profiles are of three types: Per Project: Defined in the project POM file, pom.xml. Per User: Defined in Maven settings xml file (%USER_HOME%/.m2/settings.xml). Global: Defined...View answers

Questions : 35 :: How can you activate profiles?

A Maven Build Profile can be activated in various ways: Explicitly using command console input. Through maven settings. Based on environment variables (User/System variables). OS...View answers

Questions : 36 :: What is a Maven Repository?

A repository is a place i.e. directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily.

Questions : 37 :: What types of Maven repository?

Maven repository are of three types: local, central, remote

Questions : 38 :: What is local repository?

Maven local repository is a folder location on your machine. It gets created when you run any maven command for the first time. Maven local repository keeps your project's all dependencies (library...View answers

Questions : 39 :: What is the default location for your local repository?

~/m2./repository.

Questions : 40 :: What is the command to install JAR file in local repository?

mvn install

Questions : 41 :: What is Central Repository?

It is repository provided by Maven community. It contains a large number of commonly used libraries. When Maven does not find any dependency in local repository, it starts searching in central...View answers

Questions : 42 :: What is Remote Repository?

Sometimes, Maven does not find a mentioned dependency in central repository as well then it stops the build process and output error message to console. To prevent such situation, Maven provides...View answers

Questions : 43 :: What is the sequence in which Maven searches for dependency libraries?

Following is the search pattern: Step 1 - Search dependency in local repository, if not found, move to step 2 else if found then do the further processing. Step 2 - Search dependency in...View answers

Questions : 44 :: Why are Maven Plugins used?

Maven Plugins are used to : create jar file. create war file. compile code files. unit testing of code create project documentation. create project...View answers

Questions : 45 :: What are the types of Maven Plugins?

Maven provides following two types of Plugins: Build plugins: They execute during the build and should be configured in the element of pom.xml Reporting plugins: They execute during the...View answers

Questions : 46 :: When does Maven use External Dependency concept?

Maven dependency management using concept of Maven Repositories (Local, Central, Remote). Suppose dependency is not available in any of remote repositories and central repository; in such scenarios...View answers

Questions : 47 :: What are the things you need to define for each external dependency?

External dependencies (library jar location) can be configured in pom.xml in same way as other dependencies. Specify groupId same as name of the library. Specify artifactId same as name of...View answers

Questions : 48 :: What is Archetype?

Archetype is a Maven plugin whose task is to create a project structure as per its template.

Questions : 49 :: What is the command to create a new project based on an archtype?

Type the following command: mvn archetype:generate

Questions : 50 :: What is SNAPSHOT in Maven?

SNAPSHOT is a special version that indicates a current development copy. Unlike regular versions, Maven checks for a new SNAPSHOT version in a remote repository for every build.

Questions : 51 :: What is difference between Snapshot and Version?

In case of Version, if Maven once downloaded the mentioned version say data-service:1.0, it will never try to download a newer 1.0 available in repository. To download the updated code, data-service...View answers
More Question

Ask your interview questions on Maven

Write Your comment or Questions if you want the answers on Maven from Maven Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---