CodexBloom - Programming Q&A Platform

Maven scenarios to execute 'mvn clean install' with 'how to to find version for org.slf4j:slf4j-api' after modifying parent POM

πŸ‘€ Views: 436 πŸ’¬ Answers: 1 πŸ“… Created: 2025-07-02
maven dependency-management parent-pom Java

I'm sure I'm missing something obvious here, but Quick question that's been bugging me - I recently modified the parent POM of my multi-module Maven project to include a new dependency for `org.slf4j:slf4j-api:1.7.30`, but now when I run `mvn clean install`, it throws the following behavior: ``` [behavior] Unable to find version for org.slf4j:slf4j-api:1.7.30 in the repository after modifying the parent POM ``` I've checked the repository configuration and ensured that the changes were committed. Here’s how the updated parent POM looks: ```xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>parent-project</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <dependencyManagement> <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.30</version> </dependency> </dependencies> </dependencyManagement> </project> ``` I've also verified that the repository URL is correct and accessible, and I cleared the local repository cache by running `mvn clean`. Additionally, I confirmed that the `repositories` section is present in my POM: ```xml <repositories> <repository> <id>central</id> <url>https://repo.maven.apache.org/maven2</url> </repository> </repositories> ``` I even tried running `mvn dependency:tree` to see if the dependency was being resolved correctly, but it still throws the same behavior. What could be causing this scenario, and how can I resolve it? Any insights would be appreciated! I'm working on a application that needs to handle this. What's the best practice here?