Interview Questions and Answers for 'Maven' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Maven' - 52 question(s) found - Order By Rating

next 30
 Q1. What are the disadvantages of Maven ?Maven
Ans. Maven requires installation in the working system and the Maven plug-in for the IDE.
If the Maven code for an existing dependency is unavailable, you cannot add that dependency using Maven itself.
Some sources claim that Maven is slow.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q2. Which maven commands you usually work with ?Maven
 This question was recently asked at 'Akvelon'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven     Asked in 1 Companies


 Q3. How can we request maven to set up class path within the IDEMaven
Ans. We can do mvn eclipse:eclipse or mvn idea:idea depending on the type of IDE

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     IDE  Maven


 Q4. What is the purpose of doing mvn eclipse:eclipse or man idea:ideaMaven
Ans. It is an instruction to maven to set up files ( class path , project ) within the IDE

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     IDE  eclipse  intelliJ  Maven


 Q5. Have you ever had problems with SCM checkouts or tagging while doing release build in Maven ?Maven
Ans. Yes Sometimes due to caching , conflicting tags , or incorrect scm info within pom.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q6. What is the difference between Maven and Jenkins ? Tools
Ans. Maven is a build tool whereas Jenkins is continuous integration system.

Maven deals with application compilation, build and packaging whereas Jenkins tracks SCM for triggering builds and packages, triggering parent project builds upon dependencies, initiating builds and performing alerts. So Jenkins is kind of a wrapper around SCM and Build Tool for continuous integration and deployment.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven  jenkins  build tools


 Q7. What version of Maven are you working with ? Are you aware of changes in the most recent version of Maven ?Maven
Ans. 3.3.9

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q8. What is the parent child relationship in Maven ?Maven
Ans. Maven provides a facility to have a structure of inheritance relationship between modules / projects through parent tag in POM file. When we try building the parent project , all its child modules are built first in the order specified in the parent POM file.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven     Asked in 1 Companies


 Q9. Write a Program to check if string is a Colidrome ?
(Colidrome is a word that has n alphabets followed by the reverse of the n alphabets, for ex - mallom)
Core Java
Ans.
public class Class {
   public static void main(String[] args) {
      String str = "mallam";
      String firstHalf = str.substring(0, str.length() / 2);
      String secondHalf = str.substring(str.length() / 2);

      if (firstHalf.equals(new StringBuilder(secondHalf).reverse().toString())) {
         System.out.println("It's a Colidrome");
      } else {
         System.out.println("It's not a Colidrome");
      }
   }
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Colidrome  String  Code  Coding     Asked in 1 Companies


 Q10. Difference between Maven and Ant ?Maven
Ans. Ant is procedural, we need to provide information about what to do and when to do through code.

Maven is declarative, everything is defined in the pom file.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven  maven vs ant     Asked in 1 Companies


  Q11. What is Maven ?Maven
Ans. Maven is a build automation tool used primarily for Java projects.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven  build     Asked in 6 Companies      basic        frequent


 Q12. How to perform Maven Build and show Debug Information ?Maven
Ans. Use -X option

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     


 Q13. How to specify the sequence in which sub modules needs to be built ?Maven
Ans. By specifying the modules in the same sequence in the parent pom.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven  pom file  maven modules


  Q14. Write a Program to check if 2 strings are Anagrams ?Core Java
Ans. public void checkIfAnagram(String str1,String str2){
boolean anagram = true;
for(char c:str1.toCharArray()){
if(!str2.contains(String.valueOf(c))){
System.out.println("Strings are Anagrams");
anagram = false;
}

if(anagram == true){
System.out.println("Strings are not Anagrams");
}
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve      check if 2 strings are Anagrams     Asked in 30 Companies      basic        frequent


 Q15. Difference between Maven Project and Module ?Maven
Ans. Maven Module has a Parent whereas Project doesnt. when we add the parent section to the pom file, it adds the module section to the parent project pom file. 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 first.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven project vs module  maven project  maven module        frequent


 Q16. What is the POM packaging in Maven ?Maven
Ans. pom packaging is simply a specification that states the primary artifact is not a war or jar, but the pom.xml itself.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     pom  pom packaging  maven module


 Q17. If Project A is calling web service of project B and there are some changes in project B, Will Project A needs to be rebuilt ?Maven
Ans. That depends if the interface for the resource in Project B gets changed. If only the internal implementation is changed, No change is required in Project A. Project A is not even required to be rebuilt.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     project dependencies


 Q18. What is a Test Dependency Scope in Maven ?Maven
Ans. This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. This scope is not transitive.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven     Asked in 2 Companies


 Q19. How do you resolve Maven Dependencies issue while upgrading dependencies versions ?Maven
Ans. Step 1 - Upgrade the required dependency , perform build and check build errors

Step 2.1 - If the error is of missing transitive dependency ( which is rare and means that the previous version has a dependency which is missing in the later version ), I would look for the dependency in google and hence will include it as direct dependency in Pom file.

Step 2.2. If the error is for Duplicate dependencies , and the choice is between transitive and direct dependency, I usually remove the direct dependency.

Step 2.3 - If the error is for Duplicate dependencies , and both are transitive dependencies. I first make a choice ( usually later 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 within maven-enforcer-plugin config.

Step 3 - Perform a Clean Build.

Step 4 - Check Maven Dependency Tree to make sure that Duplicates have been removed or dependency is there in case of missing dependency.

Step 5 - Perform tests and make sure that there are no runtime problems.

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 )

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven  maven dependency  transitive dependency


 Q20. What are the build lifecycles of Maven ?Maven
Ans. Default , Clean and Site.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven


 Q21. What are different dependency scopes in Maven ?Maven
Ans. Compile

This is the default scope. Compile dependencies are available in all classpaths of a project. Moreover, these dependencies are propagated to dependent projects.

Provided

This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime.

Runtime

This scope indicates that the dependency is not required for compilation, but is for execution.

Test

This scope indicates that the dependency is is only available for the test compilation and execution phases. This scope is not transitive.

System

This scope is similar to provided except that you have to provide the JAR which contains it explicitly.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven  maven dependency scopes


 Q22. How to tackle duplicate classes in maven build ?Maven
Ans. The simplest way is to ignore them if Maven enforcer plugin is complaining about it but it may lead to runtime problems later.

We can do the dependency:tree to see from where these duplicate ones are coming and hence can exclude the duplicate one.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   ban duplicate classes enforcer plugin


 Q23. Have you heard of Ban Duplicate Classes Maven enforcer plugin ? What is its use ?Maven
Ans. Yes , we have been using this plugin with our projects and its purpose is to warn and stop the Build if there are duplicates of the same package and class are being carried either directly or through transitive dependencies. the duplicate could be coming through different types of dependencies or through different versions of the same dependency. Its purpose is to make sure that there is only one copy thats being used at compile time and runtime and hence shouldnt later result in runtime problems.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   ban duplicate classes enforcer plugin


Very frequently asked. Among first few questions in almost all interviews. Among Top 5 frequently asked questions. Frequently asked in Indian service companies (HCL,TCS,Infosys,Capgemini etc based on multiple feedback ) and Epam Systems
  Q24. Difference between == and .equals() ?Core Java
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality, whereas "==" operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory.

x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object.

Sample code:

String x = new String("str");
String y = new String("str");

System.out.println(x == y); // prints false
System.out.println(x.equals(y)); // prints true

  Sample Code for equals

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string comparison   string   object class   ==    equals   object equality  operator   == vs equals   equals vs ==     Asked in 294 Companies      basic        frequent

Try 6 Question(s) Test


 Q25. What is the best practice configuration usage for files - pom.xml or settings.xml ?Maven
Ans. The best practice guideline between settings.xml and pom.xml is that configurations in settings.xml must be specific to the current user and that pom.xml configurations are specific to the project.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   build technologies   pom.xml   settings.xml   architecture   technical architect   technical lead   build management   build and release

Try 1 Question(s) Test


 Q26. How can I change the default location of the generated jar when I command "mvn package"?Maven
Ans. By default, the location of the generated jar is in ${project.build.directory} or in your target directory. We can change this by configuring the outputDirectory of maven-jar-plugin.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   build technologies   build management   build and release   release management


 Q27. What is Maven's order of inheritance?Maven
Ans. 1. parent pom
2. project pom
3. settings
4. CLI parameters

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   build technologies   pom.xml   parent pom   project pom   build management

Try 1 Question(s) Test


 Q28. What is a Mojo?Maven
Ans. 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.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   build technologies   mojo


 Q29. How do I determine which POM contains missing transitive dependency?Maven
Ans. run mvn -X

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   build technologies   pom   build management


 Q30. Where do we configure repositories in Maven ?Maven
Ans. Within settings.xml in either MAVEN_HOME or .M2 directory.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     maven   maven repository


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: