CodexBloom - Programming Q&A Platform

Maven fails to resolve dependency versions correctly in parent POM configuration with Spring 5.3

👀 Views: 0 💬 Answers: 1 📅 Created: 2025-07-07
maven spring dependency-management XML

I'm a bit lost with I'm stuck on something that should probably be simple... I'm sure I'm missing something obvious here, but I'm encountering an issue where my Maven build does not resolve the dependency versions defined in my parent POM correctly, which is causing runtime issues in my Spring application. I'm using Maven 3.6.3 and Spring Framework 5.3. In my parent `pom.xml`, I have the following dependency management section: ```xml <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>5.3.10</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>5.3.10</version> </dependency> </dependencies> </dependencyManagement> ``` In my child module's `pom.xml`, I have the following dependencies: ```xml <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <!-- I want this to inherit 5.3.10 from parent --> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <!-- I want this to inherit 5.3.10 from parent --> </dependency> </dependencies> ``` However, when I build the project, I see the following warning: ``` [WARNING] The project com.example:my-child-module:1.0.0-SNAPSHOT (C:\path\to\my-child-module\pom.xml) has 2 build failures. [WARNING] The following dependencies are not found: - org.springframework:spring-core:jar:5.3.10 - org.springframework:spring-web:jar:5.3.10 ``` I've tried adding the `spring-core` and `spring-web` dependencies directly in the child module's `pom.xml` with the specific version, but that defeats the purpose of using the parent POM. I've also checked that the parent POM is correctly defined in the child module: ```xml <parent> <groupId>com.example</groupId> <artifactId>my-parent-module</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> ``` I’ve verified that my local Maven repository does contain the required Spring dependencies ( `~/.m2/repository/org/springframework/spring-core/5.3.10`) and tried running `mvn clean install` multiple times. Any insights on why the dependencies are not resolving correctly? Is there a specific configuration or order that I might be missing? What's the best practice here?