Skip to content
Sharp

Build Tools interview questions

Build Lifecycle, Continuous Integration, Dependency Management

48 questions with answers and explanations · 48 flashcards

Questions

  1. Why can automatic transitive dependency management in build tools like Maven or Gradle become a problem in production code?Multiple choiceHard
  2. In a Maven project, where do you declare a dependency for a new library you want to use?Multiple choiceEasy
  3. Which Maven command would you use to ensure that the project is cleaned and rebuilt, including tests?Multiple choiceMedium
  4. When using Maven, which phase is responsible for verifying the quality of the code by running integration tests?Multiple choiceEasy
  5. In a Maven project, how are dependencies typically fetched?Multiple choiceEasy
  6. How does Maven resolve dependencies that are not present in the local repository?Multiple choiceEasy
  7. Which of the following is a primary benefit of using Gradle over Ant for building Java projects?Multiple choiceEasy
  8. What issue might arise when using multiple dependencies in a Maven project, and how can it be mitigated?Multiple choiceMedium
  9. Which of the following best describes the purpose of the <dependencyManagement> section in a Maven POM?Multiple choiceMedium
  10. Why is it beneficial to automate the compilation and testing in a Java project?Multiple choiceEasy
  11. How can you prevent Gradle from resolving a transitive dependency?Multiple choiceHard
  12. How would you explain a key difference between unit tests and integration tests in the context of an e-commerce Java application in an interview?Multiple choiceHard
  13. In Gradle, how can you configure a task to execute only if another task has been executed without failure?Multiple choiceHard
  14. How would you explain a 'dependency lock' file used for in Gradle in an interview?Multiple choiceMedium
  15. Why might you choose to use integration tests sparingly in a Maven build?Multiple choiceHard
  16. What problem does pinning the Java toolchain solve?Multiple choiceMedium
  17. What happens if a test fails during the 'test' phase in a Maven build?Multiple choiceMedium
  18. What is 'dependency hell', and how can it be avoided in a Gradle project?Multiple choiceHard
  19. Why do teams use a locking mechanism for dependencies in a Gradle project in production code?Multiple choiceHard
  20. How can you fail a build in Maven if even a single test fails?Multiple choiceMedium
  21. Why should local development and CI both use the same wrapper command such as ./gradlew test?Multiple choiceMedium
  22. In a Gradle build script, where should you declare a dependency to ensure it is available to the entire project?Multiple choiceEasy
  23. Which of the following describes a transitive dependency in a build tool like Maven or Gradle?Multiple choiceMedium
  24. Which build tool allows defining dependencies directly in a build script?Multiple choiceMedium
  25. How can you configure a Maven project to skip a specific module's tests when running the build?Multiple choiceHard
  26. What primary advantage does using a centralized repository offer in build tools like Maven or Gradle?Multiple choiceEasy
  27. In a Maven multi-module project, how can you ensure that a module builds its artifact only if its dependencies' tests pass?Multiple choiceMedium
  28. What happens if two dependencies bring in different versions of the same transitive dependency in Gradle?Multiple choiceMedium
  29. In a Gradle project, if a dependency is updated in a remote repository, how can you force your project to use this updated version?Multiple choiceHard
  30. Which of the following is a key advantage of using Mockito in unit tests?Multiple choiceMedium
  31. How would you configure a Gradle build to skip tests during the build process?Multiple choiceHard
  32. In a typical Maven build lifecycle, which phase comes immediately before 'install'?Multiple choiceMedium
  33. Which section of a Maven pom.xml allows you to define versions of transitive dependencies used across multiple modules?Multiple choiceHard
  34. Which command would you use in Gradle to only compile the Java source files without running tests or creating a package?Multiple choiceEasy
  35. How can you ensure that a specific Maven profile is active only during a release build?Multiple choiceHard
  36. Why does the 'package' phase in a Maven build matter in practice?Multiple choiceEasy
  37. How does Gradle handle transitive dependencies by default?Multiple choiceMedium
  38. In the context of Maven, what does it mean when a dependency is marked as 'optional'?Multiple choiceMedium
  39. How would you explain a common strategy to manage transitive dependency conflicts in a Maven project in an interview?Multiple choiceMedium
  40. What command is used to compile a Maven project?Multiple choiceEasy
  41. Why should a team commit the Gradle Wrapper or Maven Wrapper?Multiple choiceEasy
  42. If application behavior changes after adding one library and your own code barely changed, what should you inspect first?Multiple choiceHard
  43. In a Maven project, which lifecycle phase is responsible for running tests?Multiple choiceEasy
  44. In a Gradle project, what is the effect of a failing test during the 'test' task execution?Multiple choiceMedium
  45. In Gradle, which command would you use to run tests and build the project in one go?Multiple choiceMedium
  46. In Gradle, how do you ensure a specific version of a library is used across all modules of a multi-module project?Multiple choiceMedium
  47. In a multi-module Maven project, how can you ensure that a module does not build its artifact if its tests fail?Multiple choiceHard
  48. Why do teams use a central repository in build tools like Maven or Gradle in production code?Multiple choiceHard