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。

相关推荐
咕噜企业分发小米3 小时前
豆包大模型在药物研发中的知识检索效率如何?
java·开发语言·数据库
Remember_9933 小时前
【LeetCode精选算法】二分查找专题一
java·数据结构·算法·spring·leetcode·哈希算法
BlockChain8883 小时前
Web3 后端面试专用版
java·面试·职场和发展·go·web3
BlockChain8883 小时前
30+ 技术人转型 Web3 / AI
java·人工智能·go·web3
Kratzdisteln3 小时前
【1902】0120-3 Dify变量引用只能引用一层
android·java·javascript
秋刀鱼程序编程3 小时前
Java基础入门(七)---异常处理
java·开发语言·python
遇见你的雩风3 小时前
Java---多线程(一)
java·开发语言
这就是佬们吗4 小时前
力扣---leetcode48
java·笔记·后端·算法·leetcode·idea
冗量4 小时前
Cucumber: 参考
java·bdd·cucumber
冗量4 小时前
Cucumber:参数类型与配置详解
java·bdd·cucumber