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。

相关推荐
ask_baidu19 分钟前
监控Source端Pg对Flink CDC的影响
java·大数据·postgresql·flink
技术宅星云25 分钟前
0x00.Spring AI Agent开发指南专栏简介
java·人工智能·spring
Arenaschi31 分钟前
关于垃圾的CSDN
java·网络·chrome·笔记·其他·oracle·pdf
欧洵.31 分钟前
深入理解TCP协议
java·网络·tcp/ip
砚边数影31 分钟前
KingbaseES基础(二):SQL进阶 —— 批量插入/查询 AI 样本数据实战
java·数据库·人工智能·sql·ai
独自归家的兔36 分钟前
Java性能优化实战:从基础调优到系统效率倍增 -2
java·开发语言·性能优化
独自归家的兔41 分钟前
Java性能优化实战:从基础调优到系统效率倍增 - 1
java·开发语言·性能优化
Coder_Boy_43 分钟前
基于SpringAI的在线考试系统-DDD(领域驱动设计)核心概念及落地架构全总结 (2)
java·人工智能·spring boot·架构·serverless·ddd·服务网格
Coder_Boy_44 分钟前
基于SpringAI的在线考试系统-考试系统DDD(领域驱动设计)实现步骤详解(2)
java·前端·数据库·人工智能·spring boot