MCQs > IT & Programming > Maven MCQs > Basic Maven MCQs

Basic Maven MCQ

1. When building a Maven Archetype, where do you put your prototype files?

Answer

Correct Answer: Src/main/resources/archetype-resources

Note: This Question is unanswered, help us to find answer for this one

2. What is the default value of the warSourceDirectory configuration property of the Maven WAR Plugin?

Answer

Correct Answer: /src/main/WEB-INF

Note: This Question is unanswered, help us to find answer for this one

3. How do you skip the tests when running a mvn package command?

Answer

Correct Answer: Use -DskipTests=true

Note: This Question is unanswered, help us to find answer for this one

4. What is the main purpose of the install phase?

Answer

Correct Answer: To install all of the remote dependencies

Note: This Question is unanswered, help us to find answer for this one

5. Why is it best practice to avoid overriding the default directory structure?

Answer

Correct Answer: All of these answers

Note: This Question is unanswered, help us to find answer for this one

6. How do you check for unused dependencies in your project?

Answer

Correct Answer: Run the analyze goal of the dependency plugin.

Note: This Question is unanswered, help us to find answer for this one

7. For what purpose can plugins use the validate phase in the default lifecycle?

Answer

Correct Answer: To carry out checks before building the project

Note: This Question is unanswered, help us to find answer for this one

8. What are the phases of the clean lifecycle?

Answer

Correct Answer: Pre-clean,clean and post-clean

Note: This Question is unanswered, help us to find answer for this one

9. What is one of the advantages of using properties in Maven?

Answer

Correct Answer: You can avoid hard-coding values in multiple places.

Note: This Question is unanswered, help us to find answer for this one

10. What is the default scope for Maven dependencies?

Answer

Correct Answer: Compile

Note: This Question is unanswered, help us to find answer for this one

11. Which build plugin allows you to create a "fat" JAR file that contains all of the dependencies in the final JAR file?

Answer

Correct Answer: Shade

Note: This Question is unanswered, help us to find answer for this one

12. In multimodule projects, what do child POMs inherit from the parent POM?

Answer

Correct Answer: All of these answers

Note: This Question is unanswered, help us to find answer for this one

13. Suppose you are using Maven in a corporate environment and, to save bandwidth, you want to prevent the need for large numbers of developers to download the same dependency from the internet. What do you do to limit this?

Answer

Correct Answer: Create an internal corporate repository to store copies of the necessary artifacts.

Note: This Question is unanswered, help us to find answer for this one

14. The settings.xml file that provides the user-specific settings for Maven is contained in which directory by default?

Answer

Correct Answer: ${user.home}/.m2/settings.xml

Note: This Question is unanswered, help us to find answer for this one

15. Why might you not want to include groupId and version elements in child POM files?

Answer

Correct Answer: These elements are inherited from the parent POM file, and do not need to be repeated.

Note: This Question is unanswered, help us to find answer for this one

16. Suppose you are packaging a Maven project and see the following error: “[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!” What do you add to your POM file to set the platform encoding to ensure your build is not platform dependent?

Answer

Correct Answer:

Note: This Question is unanswered, help us to find answer for this one

17. What does the mvn clean command do?

Answer

Correct Answer: It removes the target directory

Note: This Question is unanswered, help us to find answer for this one

18. These are two general uses of plugins. The first is build and the second is _

Answer

Correct Answer: Reporting

Note: This Question is unanswered, help us to find answer for this one

19. When performing a release using the Maven release plugin, which environment variable for batch mode is used to define the stamp placed in SCM to indicate the state of the artifact for the actual release?

Answer

Correct Answer: ReleaseVersion

Note: This Question is unanswered, help us to find answer for this one

20. What argument do you pass to Maven in order to update SNAPSHOT from the remote repository?

Answer

Correct Answer: -U

Note: This Question is unanswered, help us to find answer for this one

21. When defining a dependency that is included with the runtime container, what scope do you use in the pom.xml?

Answer

Correct Answer: Provided

Note: This Question is unanswered, help us to find answer for this one

22. What is the default packaging type for a Maven project build artifact?

Answer

Correct Answer: JAR

Note: This Question is unanswered, help us to find answer for this one

23. If you want to utilitze a locally developed JAR file in another project and that JAR file has not been deployed to either the Maven central repository or your own locally sourced mirror repository, what Maven goal do you need to execute on the locally developed JAR project?

Answer

Correct Answer: Install

Note: This Question is unanswered, help us to find answer for this one

24. What does it mean if the scope of a dependency is runtime?

Answer

Correct Answer: The dependency is not required to compile the project, but is needed at runtime.

Note: This Question is unanswered, help us to find answer for this one

25. Which structure in a settings.xml file allows for flexing properties based on some value for the runtime of Maven?

Answer

Correct Answer: Profiles

Note: This Question is unanswered, help us to find answer for this one

26. Suppose you want to include a properties file in the JAR generated by your Maven build. What directory should you put it in?

Answer

Correct Answer: ${basedir}/src/main/resources

Note: This Question is unanswered, help us to find answer for this one

27. Why will an mvn install command not deploy any artifacts to a remote repository?

Answer

Correct Answer: The deploy phase of the default Maven lifecycle comes after the install phase.

Note: This Question is unanswered, help us to find answer for this one

28. How can Maven profiles be triggered?

Answer

Correct Answer: All of these answers

Note: This Question is unanswered, help us to find answer for this one

29. What will the mvn dependency:tree command do?

Answer

Correct Answer: Print out a report of your project's dependencies in a tree format.

Note: This Question is unanswered, help us to find answer for this one

30. How can you use Maven to run unit tests in parallel?

Answer

Correct Answer: Specify the Maven Surefire Plugin and add a configuration that sets the parallel element to true.

Note: This Question is unanswered, help us to find answer for this one

31. What environment variable can you alter to increase the memory Maven uses?

Answer

Correct Answer: MAVEN_OPTS

Note: This Question is unanswered, help us to find answer for this one

32. If your machine is behind a proxy, where should you specify the proxy server settings in order for Maven to access remote resources?

Answer

Correct Answer: Settings.xml

Note: This Question is unanswered, help us to find answer for this one

33. Which Maven plugin would you leverage to specify the version of the compiler to target as well as the source level of the language?

Answer

Correct Answer: Compiler

Note: This Question is unanswered, help us to find answer for this one

34. Many organizations set up local mirrors to the Maven central repository. In order to leverage your company's Maven repository as a proxy for the Maven central repository, which element should you put into the settings.xml file?

Answer

Correct Answer: LocalRepositories

Note: This Question is unanswered, help us to find answer for this one

35. When two dependencies of your Maven project introduce the same transitive dependency with different versions, which one(s) will be included in the dependency list for your project?

Answer

Correct Answer: The transitive dependency version of the artifact that is closest to your project

Note: This Question is unanswered, help us to find answer for this one

36. What is a valid packaging type for a Maven project?

Answer

Correct Answer: All of these answers

Note: This Question is unanswered, help us to find answer for this one

37. When building a Maven Archetype, what is the filepath and file of the archetype descriptor that specifies how to lay out the prototype files?

Answer

Correct Answer: Src/main/resources/META-INF/maven/archetype-descriptor.xml

Note: This Question is unanswered, help us to find answer for this one

38. When performing a build, which Maven plugin will allow you to set the specific version of the artifact to be built without manual modifying the pom.xml file?

Answer

Correct Answer: Versions

Note: This Question is unanswered, help us to find answer for this one

39. When building a web application with a WAR type project, which project directory should contain the style sheet, JavaScript, and other static file?

Answer

Correct Answer: Src/main/webapp

Note: This Question is unanswered, help us to find answer for this one

40. In a multimodule project, if you have a plugin bound to a phase in the parent, it will be bound to the same phase in the module. What strategy could you employ to prevent the plugin from executing in the module?

Answer

Correct Answer: Set a value in the configuration of the plugin in the module to be excluded like this: TRUE.

Note: This Question is unanswered, help us to find answer for this one

41. Which goal would you use with the Dependency plugin to determine which included dependencies are not used, as well as those you are using that you have not defined?

Answer

Correct Answer: Dependency:analyze

Note: This Question is unanswered, help us to find answer for this one

42. Which command is used to run the clean lifecyle followed by verify, install, and package with Maven?

Answer

Correct Answer: Mvn package

Note: This Question is unanswered, help us to find answer for this one

43. What directory structure contains the source code of your artifact?

Answer

Correct Answer: Src/main/java

Note: This Question is unanswered, help us to find answer for this one

44. There are several properties available for use in a pom.xml file that refer to details of the project, such as groupId and version. What do all of these properties start with?

Answer

Correct Answer: Project

Note: This Question is unanswered, help us to find answer for this one

45. What does the mvn -version command do?

Answer

Correct Answer: It print out your installed version of Maven.

Note: This Question is unanswered, help us to find answer for this one

46. The goal that is executed to generate and deploy a documentation website is _.

Answer

Correct Answer: Site

Note: This Question is unanswered, help us to find answer for this one

47. When building a Maven EAR project and specifying the configuration of which projects to include, what is the element in the plugin configuration that contains Enterprise Java Bean projects?

Answer

Correct Answer: Modules/ejbModule

Note: This Question is unanswered, help us to find answer for this one

48. If you wish to build and package your artifact using the Maven package goal but don't want to execute the unit tests, which environment variable and value would you use?

Answer

Correct Answer: Maven.test.skip=TRUE

Note: This Question is unanswered, help us to find answer for this one

49. What element in the pom.xml file allows you to provide values that can be reused in other elements of the pom.xml?

Answer

Correct Answer: Parent

Note: This Question is unanswered, help us to find answer for this one