Maven Interview Questions and Answers

Maven Interview Questions and Answers for you :

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.

Example :

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“.

Path :C:\apache-maven-2.0.9\conf

Find the following pattern 

<proxies>

<!– proxy

| Specification for one proxy, to be used in connecting to the network.

|

<proxy>

<id>optional</id>

<active>true</active>

<protocol>http</protocol>

<username>proxyuser</username>

<password>proxypass</password>

<host>proxy.host.net</host>

<port>80</port>

<nonProxyHosts>local.net|some.host.com</nonProxyHosts>

</proxy>

–>

</proxies>

Comment out the proxy setting and fill in your proxy information.

<proxies>

 

<proxy>

<id>optional</id>

<active>true</active>

<protocol>http</protocol>

<username>proxyuser</username>

<password>proxypass</password>

<host>proxy.yourcompany.com</host>

<port>80</port>

<nonProxyHosts>local.net|some.host.com</nonProxyHosts>

</proxy>

 

</proxies>

This entry was posted in Java Programing, Java Questions & Answers and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>