Here we have written all maven based interview questions with answers,solutions and proper explanations so that you could give answers all maven based interview questions properly.
Important command for using maven :
To generate maven project :mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.0 -DgroupId=com.maventest -DartifactId=testnew -Dversion=1.0-SNAPSHOT
To making the project as eclipse project : mvn eclipse:eclipse
To removing the class path api etc : mvn clean
To extracting the war file : mvn install
For running the test class : mvn test
For making the application as web application in eclips : mvn eclipse:eclipse -Dwtpversion=2.0
What is maven ?
Ans :Apache Maven, is an innovative software project management tool, provides new concept of a project object model (POM) file to manage project’s build, dependency and documentation. The most powerful feature is able to download the project dependency libraries automatically.
How to verify maven is installed on windows ?
Ans :To verify it, in command prompt, type “mvn –version” to verify the installation detail.
C:\Documents and Settings\searchcrone>mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0_13
Java home: C:\Program Files\Java\jdk1.6.0_13\jre
Default locale: en_US, platform encoding: Cp1252
OS name: “windows xp” version: “5.1” arch: “x86” Family: “windows”
If above similar type message you are getting then it is installed.
How to enable proxy services in maven,to bypass proxy ?
Ans : Mostly your company is set up a firewall and force the developers to connect internet via using HTTP proxy. If you are using HTTP proxy, Maven may not able to download the dependency libraries outside. To bypass it, you have to enable the proxy setting in Maven configuration file “settings.xml“.
Find the following pattern
| Specification for one proxy, to be used in connecting to the network.
Comment out the proxy setting and fill in your proxy information.