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. |
|
| ||||
Interview Questions and Answers for 'Maven' - 52 question(s) found - Order By Newest | ||||
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 | ||||
| ||||
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 | ||||
| ||||
Ans. Transitive dependency is the dependencies not defined directly in the current POM but the POM of the dependent projects. Yes we can override transitive dependency version by specifying the dependency in the current POM. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven dependencies   maven transitive dependency   technical lead   build management | ||||
Usually asked to experienced developers. | ||||
| ||||
Ans. A has dependency of B, B has dependency of C and C has dependency of A With Maven 2 , came transitive dependency wherein in above scenario, C will acts as a dependency of A as if this dependency has been defined directly in A but the negative side is that if it leads to cyclic dependency , it creates problems. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   dependencies   cyclic dependencies   transitive dependencies   build management Asked in 1 Companies   frequent | ||||
| ||||
Ans. A depends upon B and B depends upon C then A marks C as excluded. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   dependency exclusion | ||||
| ||||
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 | ||||
| ||||
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 | ||||
| ||||
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 | ||||
| ||||
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 | ||||
| ||||
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 | ||||
| ||||
Ans. Local and Remote. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven repository | ||||
| ||||
Ans. It refers to the settings.xml to look for the repositories to look for the resource. First It looks into the configured local repository, then it looks into the configured Remote repositories. If the resource is still not found , it looks it within maven repository central i.e repo1.maven.org. If its still not found, it throws the exception saying "Unable to find resource in repository central". | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven repository | ||||
| ||||
Ans. Its the repository provided by Maven. In case your POM specify the dependencies and its not available in the configured local and the remote repository. It then looks for the resource in Maven Central. Maven provides most of the generic dependency resources at this remote location. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven repository | ||||
| ||||
Ans. parent pom -> project pom -> settings -> CLI parameters | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Export | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven dependencies | ||||
| ||||
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 | ||||
| ||||
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 | ||||
| ||||
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 | ||||
| ||||
Ans. If its already there in Maven local repository, We can add that as a dependency in the project pom file with its Group Id, Artifact Id and version. We can provide additional attribute SystemPath if its unable to locate the jar in the local repository. If its not there in the local repository, we can install it first in the local repository and then can add it as dependency. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven dependencies   jar   architecture | ||||
| ||||
Ans. Yes, It happens many times but I would usually perform mvn eclipse:eclipse and this would resolve the project refresh problems. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven repository   eclipse Asked in 1 Companies | ||||
| ||||
Ans. Compile compiles the source code of the project whereas Install installs the package into the local repository, for use as a dependency in other projects locally | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   install   build management | ||||
| ||||
Ans. mvn clean install -Dmaven.test.skip=true or mvn install -DskipTests or within parent POM file. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven install   unit testing   unit tests | ||||
| ||||
Ans. Using mvn dependency:tree | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven repository   maven dependencies   dependency tree | ||||
| ||||
Ans. Transitive dependencies allows to avoid specifying the libraries that are required by the project which are specified in other dependent projects - Remote or Local. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven repository   dependencies   transitive dependencies   build management | ||||
| ||||
Ans. Maven and Ant are Build Technologies whereas Jenkins is a continuous integration tool. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   ant   jenkins   build technologies | ||||
| ||||
Ans. mvn -X | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven transitive dependencies | ||||
| ||||
Ans. Local -> Remote - Maven Central | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven | ||||
| ||||
Ans. Project Object Model | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   pom | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. Maven Local | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   repositories | ||||
| ||||
Ans. ~/m2./repository | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   repositories   local repositories   m2 | ||||
| ||||
Ans. Remote | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  maven   maven plugins | ||||