Bird
0
0

Given a multi-module project with parent and two modules: core and service, if service depends on core, which dependency declaration is correct inside service/pom.xml?

medium📝 component behavior Q4 of 15
Spring Boot - Advanced Patterns
Given a multi-module project with parent and two modules: core and service, if service depends on core, which dependency declaration is correct inside service/pom.xml?
A<dependency><groupId>com.example</groupId><artifactId>service</artifactId><version>1.0</version></dependency>
B<dependency><groupId>com.example</groupId><artifactId>web</artifactId><version>1.0</version></dependency>
C<dependency><groupId>com.example</groupId><artifactId>parent</artifactId><version>1.0</version></dependency>
D<dependency><groupId>com.example</groupId><artifactId>core</artifactId><version>1.0</version></dependency>
Step-by-Step Solution
Solution:
  1. Step 1: Identify the dependency needed

    The service module depends on core, so it must declare a dependency on core.
  2. Step 2: Match groupId and artifactId

    The groupId is com.example, artifactId is core, and version matches parent.
  3. Final Answer:

    Dependency on core module with correct groupId and artifactId -> Option D
  4. Quick Check:

    Module dependency = core in service pom.xml [OK]
Quick Trick: Child module depends on other modules by artifactId [OK]
Common Mistakes:
  • Referencing self or parent as dependency
  • Using wrong artifactId in dependency

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes