Idea 下载不了源码 cannot download source

一、打开Terminal (Alt+F12),找到项目具体模块所在的文件夹,输入一下指令

bash 复制代码
mvn dependency:resolve -Dclassifier=sources

如果你的idea 终端无法使用mvn指令,要配置你idea中的maven的环境变量:

1、找到maven在idea中的位置,在你idea安装目录下的\plugins\maven

2、接下来配置环境变量:在你的用户变量,特别注意是用户变量中创建Path,然后将 你idea安装目录+\plugins\maven\lib\maven3\bin 复制进去

然后,重启Idea

二、如果你执行第一步时 下载时: Download from central 从中心仓库下载很慢,pom中添加如下:

复制代码
  <repositories>
        <repository>
            <id>aliyun</id>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>aliyun-plugin</id>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

pom中更换阿里云仓库时不要忽略了pluginRepositories,原来,只有项目本身的依赖,走了aliyun这个repository,maven命令需要的插件(比如clean、install都是maven的插件),走的还是默认的repository。

相关推荐
柒.梧.6 分钟前
吃透Spring Bean:生命周期、单例特性、作用域及扩展方式
java·后端·spring
zihan03218 分钟前
若依(RuoYi)框架核心升级:全面适配 SpringData JPA,替换 MyBatis 持久层方案
java·开发语言·前端框架·mybatis·若依升级springboot
JavaLearnerZGQ33 分钟前
在Windows上使用Ollama工具本地部署deepseek-r1:7b
ide
神奇大叔40 分钟前
Java 配置文件记录
java·开发语言
锥栗1 小时前
【其他】基于Trae的大模型智能应用开发
android·java·数据库
毕设源码-郭学长1 小时前
【开题答辩全过程】以 个人任务管理系统APP为例,包含答辩的问题和答案
java
专注VB编程开发20年2 小时前
vb.net,c#线程池 Dim tasks As New List(Of Task) 线程多了,后面几个可能要等一二秒后再启动
java·linux·jvm
莫寒清2 小时前
MyBatis 中 ${} 和 #{} 有什么区别?
java·面试·mybatis
2301_804947582 小时前
nginx
java·服务器·nginx
柒.梧.2 小时前
零基础吃透Java核心基础:JDK/JRE/JVM全解析+跨平台原理
java·开发语言·jvm