Escolar Documentos
Profissional Documentos
Cultura Documentos
Questions Tests IBM WCS Java Class List Best Of Java Discussion Forum Humor Classes Search Subscribe
OpenXava Search
Code Snippets
Search
* Click to check More questions . There are more than 1600 questions currently in repository.
Interview Questions
Search
Interview Questions and Answers on Maven
Unix Command/Scripts
Search
Q1.What is Maven ?
DB Query/Scripts
Ans. Maven is a build automation tool used primarily for Java projects. Search
Ans. Ant is procedural, we need to provide information about what to do and when to do through code.
Ans. By default, the location of the generated jar is in ${project.build.directory} or in your target directory.
TRANSLATE THIS PAGE Java
We can change this by configuring the outputDirectory of maven-jar-plugin.
Tweet Java SE
Select Language
Q5. What is Maven's order of inheritance?
Collect
Ans. Accurev Stream
annotations Reader
1. parent pom
apache active File
2. project pom
apache axis Except
3. settings
apache camel Iterato
4. CLI parameters
apache cassandra Lambd
apache commons Memo
Q6. What is a Mojo? apache ink Refere
apache hive String
Ans. A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a plugin is a apache jena Thread
distribution of one or more related mojos. Zip
apache mahout
Apache OfBiz
Q7. How do I determine which POM contains missing transitive dependency?
apache pig New Cl
http://www.buggybread.com/2014/05/interview-questions-and-answers-on-maven.html 1/6
10/6/2017 Interview Questions and Answers on Maven
ektorp
Q11. How does Maven looks for a dependency or resource ? enum
exceptions
Ans. It refers to the settings.xml to look for the repositories to look for the resource. First It looks into the explainCode
configured local repository, then it looks into the configured Remote repositories. If the resource is still not
sheye
found , it looks it within maven repository central i.e repo1.maven.org. If its still not found, it throws the
Frameworks
exception saying "Unable to nd resource in repository central".
freemarker
Q12. What is maven repository central ? grails
gwt
Ans. Its the repository provided by Maven. In case your POM specify the dependencies and its not available hadoop
in the configured local and the remote repository. It then looks for the resource in Maven Central. Maven heap
provides most of the generic dependency resources at this remote location. hibernate
hive
Q13. What would you do if you have to add a jar to the project using Maven ?
hypergraph
hypergraphdb
Ans. If its already there in Maven local repository, We can add that as a dependency in the project pom file
IBM WCS
with its Group Id, Artifact Id and version.
index
We can provide additional attribute SystemPath if its unable to locate the jar in the local repository. introduced
j2ee
If its not there in the local repository, we can install it first in the local repository and then can add it as Java
dependency. java 8
java 9
Q14. Have you ever had problem getting your projects in eclipse refreshed after you made
java frameworks
changes in the Pom files ?
java.applet
java.awt
Ans. Yes, It happens many times but I would usually perform mvn eclipse:eclipse and this would resolve
the project refresh problems. java.beans
java.io
Q15. What is the difference between compile and install ? java.lang
java.math
Ans. Compile compiles the source code of the project java.net
java.nio
whereas
java.rmi
java.security
Install installs the package into the local repository, for use as a dependency in other projects locally
java.sql
Q16. How can we see Dependencies for the project and where exactly they are defined ? java.util
java5
Ans. Using java6
java7
mvn dependency:tree java8
JavaScript
Q17. What is a transitive dependency ? Can we override Transitive Dependency version and If
javax.accessibility
Yes, how ?
javax.activation Java
javax.annotation
Tweet Ans. Transitive dependency is the dependencies not defined directly in the current POM but the POM of the Java SE
dependent projects. Transitive dependencies allows to avoid specifying the libraries that are required by javax.crypto
the project which are specified in other dependent projects - Remote or Local. javax.imageio
Collect
javax.lang
Stream
Yes we can override transitive dependency version by specifying the dependency in the current POM. javax.nio Reader
javax.security File
Q18. What is a cyclic dependency ? javax.sound Except
javax.sql Iterato
Ans. A has dependency of B, B has dependency of C and C has dependency of A.
javax.swing Lambd
With Maven 2 , came transitive dependency wherein in above scenario, C will acts as a dependency of A as jaxb Memo
if this dependency has been defined directly in A but the negative side is that if it leads to cyclic jdbc Refere
dependency , it creates problems. jersey
String
jira
Thread
Q11.What is the best practice con guration usage for les - pom.xml or settings.xml ? jquery
Zip
json
Ans. The best practice guideline between settings.xml and pom.xml is that con gurations in settings.xml must be speci c to jsp
the current user and that pom.xml con gurations are speci c to the project. New Cl
jstl
jung
Q12.How can I change the default location of the generated jar when I command "mvn package"? 1.9
junit
1.8
Ans. By default, the location of the generated jar is in ${project.build.directory} or in your target directory. We can change this jvm
1.7
by con guring the outputDirectory of maven-jar-plugin. lucene
1.6
maven
1.5
Q13.How do I determine which POM contains missing transitive dependency? mockito
1.4
mongodb
1.3
Ans. run mvn -X mvc
1.2
nosql
Q14.What would you do if you have to add a jar to the project using Maven 1.1
ocjp
1.0
oops
Ans. If its already there in Maven local repository, We can add that as a dependency in the project pom le with its Group Id,
oozie
http://www.buggybread.com/2014/05/interview-questions-and-answers-on-maven.html 2/6
10/6/2017 Interview Questions and Answers on Maven
Artifact Id and version. openxava
oracle adf
We can provide additional attribute SystemPath if its unable to locate the jar in the local repository.
orm
powermock
If its not there in the local repository, we can install it rst in the local repository and then can add it as dependency.
RAD
We can do the dependency:tree to see from where these duplicate ones are coming and hence can exclude the duplicate one. Online Practice Test -
Java - OOPS and
Collections
Q23.What are different dependency scopes in Maven ?
Online Practice Test -
Ans. Compile Java - OOPs 2 Java
Tweet Java SE
This is the default scope. Compile dependencies are available in all classpaths of a project. Moreover, these dependencies are Online Practice Test -
Spring Framework 1
propagated to dependent projects. Collect
Java / J2EE Technical Stream
Provided Architect - Interview
Reader
Questions and Answers
File
This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime.
500 Java / J2EE Interview Except
Questions and Answers
Runtime Iterato
Online Practice Test - Lambd
This scope indicates that the dependency is not required for compilation, but is for execution. Java - Threads Memo
Refere
Online Practice Test -
Test BigData Hadoop String
Thread
This scope indicates that the dependency is is only available for the test compilation and execution phases. This scope is not Online Test - Java - OOPS
Zip
transitive. - Abstract Classes and
Interfaces
New Cl
System
This scope is similar to provided except that you have to provide the JAR which contains it explicitly. #WCS Consultant 1.9
Openings - Anywhere in
USA-9/29/2015-Harish 1.8
Q24.How do you resolve Maven Dependencies issue while upgrading dependencies versions ? Re: 1.7
WCS-12/17/2014-Faha 1.6
Ans. Step 1 - Upgrade the required dependency , perform build and check build errors d
1.5
Re: IBM WebSphere
1.4
Step 2.1 - If the error is of missing transitive dependency ( which is rare and means that the previous version has a dependency Commerce
8-12/16/2014-buggybr 1.3
which is missing in the later version ), I would look for the dependency in google and hence will include it as direct dependency ead
1.2
in Pom le.
Re: WCS7 Study
1.1
Material-12/16/2014-b
Step 2.2. If the error is for Duplicate dependencies , and the choice is between transitive and direct dependency, I usually uggybread 1.0
remove the direct dependency.
http://www.buggybread.com/2014/05/interview-questions-and-answers-on-maven.html 3/6
10/6/2017 Interview Questions and Answers on Maven
Re: IBM WebSphere
Step 2.3 - If the error is for Duplicate dependencies , and both are transitive dependencies. I rst make a choice ( usually later Commerce
8-12/16/2014-Rakesh
version ) and then ignore the previous version dependency.
Step 2.4 - If the error is for Duplicate dependencies , and there are more than 2 duplicates, I usually ignore it by specifying TOTAL SITE VIEWS
within maven-enforcer-plugin con g.
Name
Step 6 - If there are runtime problems ( which very likely occurs if you have different version dependencies , very likely by
doing 2.4 , you will have to remove step 2.4 and alternately perform 2.2 or 2.3 )
Email *
Q25.What is a Test Dependency Scope in Maven ?
Ans. This scope indicates that the dependency is not required for normal use of the application, and is only available for the
Message *
test compilation and execution phases. This scope is not transitive.
Ans. pom packaging is simply a speci cation that states the primary artifact is not a war or jar, but the pom.xml itself.
Ans. Maven Module has a Parent whereas Project doesnt. when we add the parent section to the pom le, it adds the module
section to the parent project pom le. When we execute mvn compile / install, it basically checks that module section of the
parent to identify all the modules that needs to be compiled rst.
Ans. By specifying the modules in the same sequence in the parent pom.
a. parent pom -> project pom -> settings -> CLI parameters
b. project pom -> parent pom -> settings -> CLI parameters
c. settings -> parent pom -> project pom -> CLI parameters
d. CLI parameters -> settings -> parent pom -> project pom
Java
Tweet Ans. parent pom -> project pom -> settings -> CLI parameters Java SE
Q30. How do I determine which POM contains missing transitive dependency? Collect
Stream
a. mvn -A
Reader
b. mvn -M
File
c. mvn -R
Except
d. mvn -X
Iterato
Ans. mvn -X Lambd
Memo
Q31. What is the sequence in which Maven looks for the resources ? Refere
String
a. Remote-> Maven Central - > Local Thread
b. Local -> Remote - Maven Central
Zip
c. Remote-> Local -> Maven Central
d. Maven Central -> Local -> Remote
New Cl
http://www.buggybread.com/2014/05/interview-questions-and-answers-on-maven.html 4/6
10/6/2017 Interview Questions and Answers on Maven
a. Local
b. Remote
c. Maven Central
d. Maven Local
a. ~/.m2/repo
b. ~/m2./home/repository
c. ~/m2./repository
d. ~/m2./home/repo
Ans. ~/m2./repository
a. Build
b. Reporting
c. Remote
d. All are valid Maven Plugin types
Ans. Remote
a. Compile
b. Test
c. System
d. Export
Ans. Export
a. <groupId>:<artifactId>:<version>
b. <groupId>:<artifactId>
c. <artifactId>:<groupId>:<version>
d. <artifactId>:<version>
Ans. <groupId>:<artifactId>:<version>
Like 16
New Cl
1.9
1.8
1.7
Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
7 Enter your email address: Subscribe
1.6
1.5
Delivered by FeedBurner
Share 1.4
1.3
1.2
1.1
1.0
http://www.buggybread.com/2014/05/interview-questions-and-answers-on-maven.html 5/6
10/6/2017 Interview Questions and Answers on Maven
0 Comments Buggybread
1 Login
Sort by Best
Recommend Share
LOG IN WITH
OR SIGN UP WITH DISQUS ?
Name
ALSO ON BUGGYBREAD
Java - Collections - Interview Questions and Java - Advanced Interview Questions for
Answers on TreeSet Experienced Professionals
2 comments 3 years ago 2 comments 3 years ago
vivekvermani Hi Vinoth. Seems like the correct Rajashekar J Its amazing explanation in
question has not been referenced as I am not simple way. Thank you guys
able to understand your comment. Regards.
Contact us at info@buggybread.com
Java
Tweet buggybread.com Java SE
New Cl
1.9
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0
http://www.buggybread.com/2014/05/interview-questions-and-answers-on-maven.html 6/6