作为一个程序猿,难免会跟源码打交道,可是在下载源码有时候,会提示找不到对象,这是什么原因呢?今天我们来解决这个问题。
问题:idea无法下载源码
Cannot download sources Sources not found for:org.springframework.boot:spring-boot-autoconfigure:3.1.7
解决方案一:
自己的仓库配置存在错误
在自己的 maven 的 conf/setting.xml 文件里修改仓库
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>aliyun_maven</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
解决方案二:
上述方法不行的情况下,可以选择在项目下,项目根目录下 或 pom.xml 同级的目录中运行
mvn dependency:resolve -Dclassifier=sources
然后点击“download source”时就能看到源码
$ mvn dependency:resolve -Dclassifier=sources
[INFO] Scanning for projects...
Downloading from ...
...
[INFO]
...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
仓库配置:
对于仓库配置,有更新,可以查看下表:
仓库名称 |
阿里云仓库地址 |
阿里云仓库地址(老版) |
源地址 |
---|---|---|---|
central |
https://maven.aliyun.com/repository/central |
https://maven.aliyun.com/nexus/content/repositories/central |
https://repo1.maven.org/maven2/ |
public |
https://maven.aliyun.com/repository/public |
https://maven.aliyun.com/nexus/content/groups/public |
central仓和jcenter仓的聚合仓 |
gradle-plugin |
https://maven.aliyun.com/repository/gradle-plugin |
https://maven.aliyun.com/nexus/content/repositories/gradle-plugin |
https://plugins.gradle.org/m2/ |
apache snapshots |
https://maven.aliyun.com/repository/apache-snapshots |
https://maven.aliyun.com/nexus/content/repositories/apache-snapshots |
https://repository.apache.org/snapshots/ |
仓库服务https://developer.aliyun.com/mvn/guide
源码自动翻译插件:
假如你苦于源码是英文,那么看到这这里你没白看,下面带来一个插件
写文档不易,希望点个赞支持一下,可以的话还可以收藏,谢谢🌹
搜索 Translation ,安装插件(都要看源码的大佬的你,肯定会如何安装插件)
安装完成重启软件后,在需要翻译的文档右击就可以翻译