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。

相关推荐
草履虫建模8 小时前
力扣算法 1768. 交替合并字符串
java·开发语言·算法·leetcode·职场和发展·idea·基础
qq_2975746711 小时前
【实战教程】SpringBoot 实现多文件批量下载并打包为 ZIP 压缩包
java·spring boot·后端
老毛肚11 小时前
MyBatis插件原理及Spring集成
java·spring·mybatis
学嵌入式的小杨同学11 小时前
【Linux 封神之路】信号编程全解析:从信号基础到 MP3 播放器实战(含核心 API 与避坑指南)
java·linux·c语言·开发语言·vscode·vim·ux
lang2015092811 小时前
JSR-340 :高性能Web开发新标准
java·前端·servlet
Re.不晚11 小时前
Java入门17——异常
java·开发语言
缘空如是11 小时前
基础工具包之JSON 工厂类
java·json·json切换
追逐梦想的张小年12 小时前
JUC编程04
java·idea
好家伙VCC12 小时前
### WebRTC技术:实时通信的革新与实现####webRTC(Web Real-TimeComm
java·前端·python·webrtc
南极星100512 小时前
蓝桥杯JAVA--启蒙之路(十)class版本 模块
java·开发语言