Maven Dependency Management and Conflict Resolution Quiz Quiz

  1. Transitive Dependencies

    Which term describes the dependencies that are automatically included when you add a Maven dependency whose own pom.xml also lists dependencies?

    1. Transitive dependencies
    2. Direct dependencies
    3. Exclusion dependencies
    4. Optional dependencies
    5. Transition dependencies
  2. Dependency Scope Understanding

    In Maven, which dependency scope ensures that a library is only available at compile time and not included in the final artifact?

    1. Provided
    2. Runtime
    3. System
    4. Compile
    5. Test
  3. Resolving Version Conflicts

    When Maven encounters multiple versions of the same dependency due to transitive dependencies, which version does it use by default?

    1. The version closest to the project in the dependency tree
    2. The lowest version numerically
    3. The highest version numerically
    4. The last declared version in pom.xml
    5. The earliest published version
  4. Excluding a Transitive Dependency

    What is the correct way to exclude a specific transitive dependency in Maven using the pom.xml?

    1. Add an u003Cexclusionu003E tag inside the u003Cdependencyu003E block
    2. Set the scope to 'exclude' in the dependency
    3. Remove it from the u003Cbuildu003E section
    4. Use u003CdependencyManagementu003E to remove the dependency
    5. Delete the dependency from the local repository
  5. DependencyManagement Usage

    What is the main purpose of the u003CdependencyManagementu003E section in a Maven pom.xml file?

    1. To centralize and control versions of dependencies for submodules
    2. To automatically update all dependencies to their latest versions
    3. To list all direct dependencies of a project
    4. To define plugin versions only
    5. To remove unused dependencies from a project
  6. Checking Effective POM

    Which Maven command shows the final resolved dependencies and configuration as Maven sees them for your project?

    1. mvn help:effective-pom
    2. mvn compile:show
    3. mvn dependency:list
    4. mvn resolve:tree
    5. mvn help:list-dependencies
  7. Optional Dependencies

    What happens when you mark a dependency as u003Coptionalu003Etrueu003C/optionalu003E in Maven?

    1. It will not be transitively included in downstream projects
    2. Maven will never download the dependency
    3. It is required for Maven to run tests
    4. The dependency will be bundled in the final jar
    5. It disables all scopes for the dependency
  8. Identifying Dependency Conflicts

    If you suspect a version conflict between dependencies, which Maven command is most useful to visualize the conflict?

    1. mvn dependency:tree
    2. mvn clean install
    3. mvn test:conflicts
    4. mvn compile:info
    5. mvn versions:check
  9. Forcing a Specific Dependency Version

    How can you force Maven to use a particular version of a dependency if multiple versions are present in the dependency tree?

    1. Explicitly declare the preferred version in your project's pom.xml dependencies section
    2. Delete all other versions from your local repository
    3. Set the preferred version in u003Cbuildu003E
    4. Rename the dependency artifact
    5. Only add the dependency in u003CdependencyManagementu003E
  10. Local Repository Role

    What is the main function of Maven's local repository?

    1. To store downloaded artifacts for offline builds
    2. To compile Java source files
    3. To list project contributors
    4. To manage version control of source code
    5. To deploy artifacts to remote servers