Bird
0
0

You want to exclude a transitive dependency from a Spring Boot starter in your pom.xml. How do you do this?

hard📝 Application Q8 of 15
Spring Boot - Fundamentals
You want to exclude a transitive dependency from a Spring Boot starter in your pom.xml. How do you do this?
ARemove the dependency from <code>pom.xml</code> entirely
BSet the dependency scope to <code>provided</code>
CUse the <code><exclusions></code> tag inside the dependency to specify the artifact to exclude
DAdd the dependency again with <code><optional>true</optional></code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand transitive dependencies in Maven

    Dependencies can bring other dependencies automatically (transitive).
  2. Step 2: Use <exclusions> to exclude unwanted transitive dependencies

    Inside the dependency block, <exclusions> specifies which transitive dependencies to skip.
  3. Final Answer:

    Use the <exclusions> tag inside the dependency to specify the artifact to exclude -> Option C
  4. Quick Check:

    Exclude transitive dependencies with <exclusions> [OK]
Quick Trick: Exclude transitive dependencies using tag [OK]
Common Mistakes:
  • Deleting dependencies instead of excluding transitive ones
  • Misusing scope to exclude dependencies
  • Using tag incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes