java
build_error
ai_generated
true
Could not resolve dependency for project com.example:my-app:jar:1.0.0: Could not find artifact com.example:missing-lib:jar:2.0.0 in central (https://repo.maven.apache.org/maven2)
ID: java/maven-dependency-not-found
80%Fix Rate
85%Confidence
0Evidence
2024-03-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 8+ | active | — | — | — |
Root Cause
The dependency artifact is not published to the configured repositories, or the repository URL is incorrect.
generic中文
依赖工件未发布到配置的仓库,或仓库 URL 不正确。
Workarounds
-
95% success Add the correct repository to pom.xml
<repositories><repository><id>my-repo</id><url>https://my-company.com/repo</url></repository></repositories>
-
90% success Install the dependency manually using mvn install:install-file
mvn install:install-file -Dfile=missing-lib-2.0.0.jar -DgroupId=com.example -DartifactId=missing-lib -Dversion=2.0.0 -Dpackaging=jar
Dead Ends
Common approaches that don't work:
-
Adding a random third-party repository without verifying its contents
90% fail
The repository may not contain the artifact, or it could be malicious.
-
Cleaning the local Maven repository (~/.m2/repository) without verifying the remote
85% fail
If the artifact is not in any remote repo, cleaning the local cache doesn't help.