Build Tools interview questions
Build Lifecycle, Continuous Integration, Dependency Management
48 questions with answers and explanations · 48 flashcards
Questions
- Why can automatic transitive dependency management in build tools like Maven or Gradle become a problem in production code?Multiple choiceHard
- In a Maven project, where do you declare a dependency for a new library you want to use?Multiple choiceEasy
- Which Maven command would you use to ensure that the project is cleaned and rebuilt, including tests?Multiple choiceMedium
- When using Maven, which phase is responsible for verifying the quality of the code by running integration tests?Multiple choiceEasy
- In a Maven project, how are dependencies typically fetched?Multiple choiceEasy
- How does Maven resolve dependencies that are not present in the local repository?Multiple choiceEasy
- Which of the following is a primary benefit of using Gradle over Ant for building Java projects?Multiple choiceEasy
- What issue might arise when using multiple dependencies in a Maven project, and how can it be mitigated?Multiple choiceMedium
- Which of the following best describes the purpose of the <dependencyManagement> section in a Maven POM?Multiple choiceMedium
- Why is it beneficial to automate the compilation and testing in a Java project?Multiple choiceEasy
- How can you prevent Gradle from resolving a transitive dependency?Multiple choiceHard
- 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
- In Gradle, how can you configure a task to execute only if another task has been executed without failure?Multiple choiceHard
- How would you explain a 'dependency lock' file used for in Gradle in an interview?Multiple choiceMedium
- Why might you choose to use integration tests sparingly in a Maven build?Multiple choiceHard
- What problem does pinning the Java toolchain solve?Multiple choiceMedium
- What happens if a test fails during the 'test' phase in a Maven build?Multiple choiceMedium
- What is 'dependency hell', and how can it be avoided in a Gradle project?Multiple choiceHard
- Why do teams use a locking mechanism for dependencies in a Gradle project in production code?Multiple choiceHard
- How can you fail a build in Maven if even a single test fails?Multiple choiceMedium
- Why should local development and CI both use the same wrapper command such as ./gradlew test?Multiple choiceMedium
- In a Gradle build script, where should you declare a dependency to ensure it is available to the entire project?Multiple choiceEasy
- Which of the following describes a transitive dependency in a build tool like Maven or Gradle?Multiple choiceMedium
- Which build tool allows defining dependencies directly in a build script?Multiple choiceMedium
- How can you configure a Maven project to skip a specific module's tests when running the build?Multiple choiceHard
- What primary advantage does using a centralized repository offer in build tools like Maven or Gradle?Multiple choiceEasy
- In a Maven multi-module project, how can you ensure that a module builds its artifact only if its dependencies' tests pass?Multiple choiceMedium
- What happens if two dependencies bring in different versions of the same transitive dependency in Gradle?Multiple choiceMedium
- 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
- Which of the following is a key advantage of using Mockito in unit tests?Multiple choiceMedium
- How would you configure a Gradle build to skip tests during the build process?Multiple choiceHard
- In a typical Maven build lifecycle, which phase comes immediately before 'install'?Multiple choiceMedium
- Which section of a Maven pom.xml allows you to define versions of transitive dependencies used across multiple modules?Multiple choiceHard
- Which command would you use in Gradle to only compile the Java source files without running tests or creating a package?Multiple choiceEasy
- How can you ensure that a specific Maven profile is active only during a release build?Multiple choiceHard
- Why does the 'package' phase in a Maven build matter in practice?Multiple choiceEasy
- How does Gradle handle transitive dependencies by default?Multiple choiceMedium
- In the context of Maven, what does it mean when a dependency is marked as 'optional'?Multiple choiceMedium
- How would you explain a common strategy to manage transitive dependency conflicts in a Maven project in an interview?Multiple choiceMedium
- What command is used to compile a Maven project?Multiple choiceEasy
- Why should a team commit the Gradle Wrapper or Maven Wrapper?Multiple choiceEasy
- If application behavior changes after adding one library and your own code barely changed, what should you inspect first?Multiple choiceHard
- In a Maven project, which lifecycle phase is responsible for running tests?Multiple choiceEasy
- In a Gradle project, what is the effect of a failing test during the 'test' task execution?Multiple choiceMedium
- In Gradle, which command would you use to run tests and build the project in one go?Multiple choiceMedium
- In Gradle, how do you ensure a specific version of a library is used across all modules of a multi-module project?Multiple choiceMedium
- In a multi-module Maven project, how can you ensure that a module does not build its artifact if its tests fail?Multiple choiceHard
- Why do teams use a central repository in build tools like Maven or Gradle in production code?Multiple choiceHard