赞
踩
我们的项目可能会报出“依赖 not found”的错误,有两个可能的原因:
1. 我们想要添加的包不在中央仓库而由别的远程仓库提供(大多数情况下!)。
2. 我们想要添加的包就是由中央仓库提供,但是中央仓库更新不及时 或者 阿里云的镜像更新不及时。
引入一个fastjson依赖包。
在远程仓库中搜索:https://mvnrepository.com/search?q=fastjson
使用这个阿里巴巴提供的fastjson。
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>fastjson</artifactId>
- <version>1.2.79</version>
- </dependency>
出现找不到依赖的错误
这个依赖包指明了就是在中央仓库里,而我们也给maven在settings.xml配置过中央仓库的阿里云镜像了。按理说一定能找到的呀?
再次去中央仓库的网站搜索:Maven Central Repository Search
居然没有搜到阿里提供的fastjson。
两个都是官方的网站,一个说有,一个说没有。
我想应该是创作者在远程仓库mvmrepository.com里注册了以后,忘记上传到中央仓库里去了吧。
自己添加<repositories>标签到pom.xml文件中,手动添加额外的仓库/额外的包。
点击进入central。
找到如下图所示的两部分内容,写入<repositories>标签
- <repositories>
- <repository>
- <id>Central repository</id>
- <url>https://repo1.maven.org/maven2/</url>
- </repository>
- </repositories>
然后,在maven侧边栏里刷新一下包,问题解决。
借鉴:maven配置,以及项目"Dependency 'xxxx‘ not found"解决过程_lixld的专栏-CSDN博客
现在不会出现这个问题了。而且中央仓库也能搜到阿里巴巴提供的fastjson了!
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。