缺少依赖项
缺少的依赖项会出现如下错误:
[INFO] Failed to resolve artifact.
Missing:
----------
1) jnuit:junit:jar:3.8.1
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=jnuit -DartifactId=junit \
-Dversion=3.8.1 -Dpackaging=jar -Dfile=/path/to/file
Path to dependency:
1) org.apache.maven:maven:pom:2.1-SNAPSHOT
2) jnuit:junit:jar:3.8.1
----------
1 required artifact is missing.
for artifact:
org.apache.maven:maven:pom:2.1-SNAPSHOT
from the specified remote repositories:
central (https://repo.maven.apache.org/maven2)
要解决此问题,这取决于依赖项是什么以及缺少它的原因。最常见的原因是因为它无法从存储库中重新分发,并且必须使用消息中给出的说明手动安装。javax.*这在 Sun 的一些较旧的 JAR(通常是组 ID)中最为常见,并且在处理 Sun JAR 的指南中有进一步的说明。
您可以检查错误末尾的存储库列表,以确保列出了预期的存储库 - 可能是项目需要未正确声明或无法通过 Maven 配置访问的替代存储库。
在其他情况下,它可能是项目需要修复的错误声明的依赖项(如上例中的拼写错误),如编译错误。
