๐Ÿ”ด The Error You're Seeing

Confirm this matches your console output. If it does, you're in the right place.

ERROR LOG[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.devinhyderabad:my-app:jar:1.0.0: Failed to collect dependencies at com.devinhyderabad:my-lib:jar:1.0.0: Failed to read artifact descriptor for com.devinhyderabad:my-lib:jar:1.0.0: Could not find artifact com.devinhyderabad:my-lib:jar:1.0.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]

โšก Quick Fix Works 80% of the time

Check for typos in the groupId, artifactId, or version in your pom.xml.

<!-- Ensure this exactly matches the Maven Central coordinates --> <dependency> <groupId>com.devinhyderabad</groupId> <artifactId>my-lib</artifactId> <version>1.0.1</version> <!-- Maybe 1.0.0 never existed, and it should be 1.0.1 --> </dependency>

๐Ÿง  Why this Happens

Tap to expand the deep technical explanation

Maven tried to download a dependency specified in your `pom.xml`, but the repository (like Maven Central or a private Nexus) responded with a 404 Not Found. This is almost always caused by a typo in the version number, a missing private repository configuration, or the library not being published yet.

The HITEC City Parking Spot Analogy:

It's like ordering a specific book at a library, but the librarian checks the catalog and says, 'That exact edition doesn't exist here.' You either have the wrong title (artifactId) or the wrong edition (version).

๐Ÿ” How to Reproduce Confirm this is your error

Add a dependency to your `pom.xml` with a version number that doesn't exist (e.g., `<version>99.99.99</version>` for Spring Boot). Run `mvn clean install`.

๐Ÿ› ๏ธ Solutions (5 Ways to Fix)

Solution 1โœ“ Most common cause

Verify the coordinates on Maven Central

๐Ÿ‘‰ Use this if you typed the dependency manually.

Go to mvnrepository.com and search for the library. Copy the exact XML snippet to ensure no typos in groupId, artifactId, or version.

<!-- Search on https://mvnrepository.com/ --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>3.2.0</version> </dependency>
Solution 2

Add a private repository to your pom.xml

๐Ÿ‘‰ Use this if the library is an internal company library not hosted on Maven Central.

If the library is hosted on a private Nexus or Artifactory, you must tell Maven where to find it.

<repositories> <repository> <id>company-nexus</id> <url>https://nexus.mycompany.com/repository/maven-public/</url> </repository> </repositories>
Solution 3

Check your VPN or network connection

๐Ÿ‘‰ Use this if you are on a corporate network that blocks Maven Central.

Corporate firewalls often block external repositories. Ensure you are connected to the VPN, or configure a proxy in Maven settings.

<!-- ~/.m2/settings.xml --> <proxies> <proxy> <id>corp-proxy</id> <host>proxy.mycompany.com</host> <port>8080</port> </proxy> </proxies>
Solution 4

Disable Maven offline mode

๐Ÿ‘‰ Use this if you previously built with the `-o` (offline) flag and forgot to turn it off.

If offline mode is stuck in your IDE or CLI, Maven won't attempt to reach the internet to download new dependencies.

mvn clean install -U // The -U flag forces Maven to update releases and snapshots
Solution 5

Clear local corrupted cache

๐Ÿ‘‰ Use this if the dependency exists but the `.jar` in your `.m2` folder is corrupted (e.g., contains HTML error pages).

Delete the specific folder in your local repository to force a fresh download.

rm -rf ~/.m2/repository/com/devinhyderabad/my-lib/ mvn clean install

๐Ÿ“‹ Version Notes

Spring Boot 2.x

Standard Maven dependency resolution.

Spring Boot 3.x

Standard Maven dependency resolution.

๐Ÿ›ก๏ธ How to Prevent This Next Time

Always copy and paste dependency coordinates directly from Maven Central or your company's Nexus repository browser.

Course Search
Search across all chapters & stages
๐Ÿ“–

Search the course

Type any topic โ€” branching, stash, rebase, hooks โ€” and jump straight to that chapter.

merge branchesgit stashundo commitrebase