Do you finished your BTech and looking for job? Having minimum experience in web programming experience, including Angular JS, HTML5, CSS3, JSP, CGI/Perl/Shell scripting can be an added advantage for you to get shortlisted for the jobs. Prepare well for the above concepts when you are attending Maven job interview. Having skills like HTML/XHTML, JavaScript, jQuery, AJAX and CSS is useful for you. Maven is an automation tool used for java projects. Maven describes about how software built and developed. It can be also used for managing other projects. Maven job interview questions and answers are built for the reference of job seekers for the best performance at interviews. Have a look at following wisdom jobs interview questions page to win in job search.
Answer :
Maven is a project management and comprehension tool. Maven provides developers a complete build lifecycle framework. Development team can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle.
Question 2. What Does It Mean When You Say Maven Uses Convention Over Configuration?
Answer :
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.
Question 3. What Are The Aspects Maven Managed?
Answer :
Maven provides developers ways to manage following:
Question 4. How Do You Know The Version Of Mvn You Are Using?
Answer :
Type the following command :
mvn --version
Answer :
POM stands for Project Object Model. It is fundamental Unit of Work in Maven. It is an XML file. It always resides in the base directory of the project as pom.xml. It contains information about the project and various configuration details used by Maven to build the project(s).
Question 6. What Information Does Pom Contain?
Answer :
POM contains the some of the following configuration information −
Question 7. What Is Maven Artifact?
Answer :
An artifact is a file, usually a JAR that gets deployed to a Maven repository. A Maven build produces one or more artifacts, such as a compiled JAR and a "sources" JAR.
Each artifact has a group ID (usually a reversed domain name, like com.example.foo), an artifact ID (just a name), and a version string. The three together uniquely identify the artifact. A project's dependencies are specified as artifacts.
Question 8. Name The 3 Build Lifecycle Of Maven?
Answer :
The three build lifecycles are:
Question 9. What Is Maven Build Lifecycle?
Answer :
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.
Question 10. What Is The Command To Quickly Build Your Maven Site?
Answer :
Type the command− mvn site
Question 11. What Would The Command Mvn Clean Do ?
Answer :
This command removes the target directory with all the build data before starting the build process.
Question 12. What Are The Phases Of A Maven Build Lifecycle?
Answer :
Following are the phases:−
Question 13. What Is A Goal In Maven Terminology?
Answer :
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 outside of the build lifecycle by direct invocation.
Question 14. What Would This Command Do Mvn Clean Dependency:copy-dependencies Package?
Answer :
This command will clean the project, copy the dependencies and package the project (executing all phases up to package).
Question 15. What Phases Does A Clean Lifecycle Consist?
Answer :
The clean lifecycle consists of the following phases:
Question 16. What Phases Does A Site Lifecycle Consist?
Answer :
The phases in Site Lifecycle are:−
Question 17. What Is Build Profile?
Answer :
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 Production v/s Development environments.
Question 18. What Are Different Types Of Build Profiles?
Answer :
Build profiles are of three types :
Question 19. How Can You Activate Profiles?
Answer :
A Maven Build Profile can be activated in various ways −
Question 20. What Is A Maven Repository?
Answer :
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.
Question 21. What Types Of Maven Repository?
Answer :
Maven repository are of three types:
Question 22. What Is Local Repository?
Answer :
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 jars, plugin jars etc).
Question 23. What Is The Default Location For Your Local Repository?
Answer :
~/m2./repository.
Question 24. What Is The Command To Install Jar File In Local Repository?
Answer :
mvn install.
Question 25. What Is Central Repository?
Answer :
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 repository using following URL: http://repo1.maven.org/maven2/.
Question 26. What Is Remote Repository?
Answer :
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 concept of Remote Repository which is developer's own custom repository containing required libraries or other project jars.
Question 27. What Is The Sequence In Which Maven Searches For Dependency Libraries?
Answer :
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 central repository, if not found and remote repository/repositories is/are mentioned then move to step 4 else if found, then it is downloaded to local repository for future reference.
Step 3 − If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency).
Step 4 − Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference otherwise Maven as expected stop processing and throws error (Unable to find dependency).
Question 28. Why Are Maven Plugins Used?
Answer :
Maven Plugins are used to:
Question 29. What Are The Types Of Maven Plugins?
Answer :
Maven provides following two types of Plugins:
Question 30. When Does Maven Use External Dependency Concept?
Answer :
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 Maven uses concept of External Dependency.
Question 31. What Are The Things You Need To Define For Each External Dependency?
Answer :
External dependencies (library jar location) can be configured in pom.xml in same way as other dependencies.
Question 32. What Is Archetype?
Answer :
Archetype is a Maven plugin whose task is to create a project structure as per its template.
Question 33. What Is The Command To Create A New Project Based On An Archetype?
Answer :
Type the following command: mvn archetype:generate
Question 34. What Is Snapshot In Maven?
Answer :
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.
Question 35. What Is Difference Between Snapshot And Version?
Answer :
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 version is be upgraded to 1.1.
In case of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service:1.0-SNAPSHOT) everytime app-ui team build their project.
Question 36. What Is Transitive Dependency In Maven?
Answer :
Transitive dependency means to avoid needing to discover and specify the libraries that your own dependencies require, and including them automatically.
Question 37. What Does Dependency Management Mean In The Context Of Transitive Dependency?
Answer :
It means to directly specify the versions of artifacts to be used when they are encountered in transitive dependencies. For an example project C can include B as a dependency in its dependencyManagement section and directly control which version of B is to be used when it is ever referenced.
Answer :
Maven determines what version of a dependency is to be used when multiple versions of an artifact are encountered. If two dependency versions are at the same depth in the dependency tree, the first declared dependency will be used. This is called dependency mediation.
Question 39. What Is Dependency Scope? Name All The Dependency Scope.?
Answer :
Dependency scope includes dependencies as per the current stage of the build. Various Dependency Scopes are −
Answer :
{groupId,artifactId,type,classifier}.
Question 41. How Do You Reference A Property Defined In Your Pom.xml File?
Answer :
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.
Answer :
Some of the valid packaging values are jar, war, ear and pom. If no packaging value has been specified, it will default to jar.
Question 43. What Is The Value For Packaging Element In Pom For A Project That Is Purely Meta-data?
Answer :
pom.
Question 44. What Is The Use Of Execution Element In Pom File?
Answer :
The <execution> element contains information's required for the execution of a plugin.
Question 45. What Is A Project's Fully Qualified Artifact Name?
Answer :
<groupId>:<artifactId>:<version>
Answer :
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.
Question 47. How Profiles Are Specified In Maven?
Answer :
Profiles are specified using a subset of the elements available in the POM itself.
Question 48. What Are The Elements In Pom That A Profile Can Modify When Specified In The Pom?
Answer :
<repositories>, <pluginRepositories>,<dependencies>, <plugins> ,<properties>, <modules><reporting>,<dependencyManagement>,<distributionManagement>
Question 49. Why Profile Is Used In Maven?
Answer :
To give portability to projects ( e.g. windows, linux etc).
Answer :
It uses less storage, it makes checking out project quicker, non need for versioning JAR files.
Question 51. How Can You Build Your Project Offline?
Answer :
Use the command: mvn o package.
Question 52. How Do You Exclude Dependency?
Answer :
Using the exclusion element.
Question 53. What Is A System Dependency?
Answer :
Dependency with scope system are always available and are not looked up in repository, they are usually used to tell Maven about dependencies which are provided by the JDK or the VM. Thus, system dependencies are especially useful for resolving dependencies on artifacts which are now provided by the JDK.
Question 54. What Is The Use Of Optional Dependency?
Answer :
Any transitive dependency can be marked as optional using "optional" element. As example, A depends upon B and B depends upon C. Now B marked C as optional. Then A will not use C.
Question 55. What Is Dependency Exclusion ?
Answer :
Any transitive dependency can be exclude using "exclusion" element. As example, A depends upon B and B depends upon C then A can mark C as excluded.
Question 56. How Can You Run The Clean Plugin Automatically During The Build?
Answer :
You can put the clean plugin inside the execution tag in pom.xml file
Question 57. How To Stop The Propagation Of Plugins To Child Poms?
Answer :
set <inherited> to false.
Answer :
It means that you have executed a plugin multiple times with the same <id>. Provide each <execution> with a unique <id> then it would be ok.
Answer :
A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a plugin is a distribution of one or more related mojos.
Question 60. What Is Difference Between Apache Ant And Maven?
Answer :
Ant is simply a toolbox whereas Maven is about the application of patterns in order to achieve an infrastructure which displays the characteristics of visibility, reusability, maintainability, and comprehensibility. It is wrong to consider Maven as a build tool and just a replacement for Ant.
Maven Related Practice Tests |
|
---|---|
Java Script Practice Tests | Adv Java Practice Tests |
Core Java Practice Tests | Maven Practice Tests |
JUnit Practice Tests | Java 8 Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.