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。

相关推荐
RainbowSea9 分钟前
跨域问题(Allow CORS)解决(3 种方法)
java·spring boot·后端
掘金-我是哪吒10 分钟前
分布式微服务系统架构第155集:JavaPlus技术文档平台日更-Java线程池实现原理
java·分布式·微服务·云原生·架构
RainbowSea13 分钟前
问题 1:MyBatis-plus-3.5.9 的分页功能修复
java·spring boot·mybatis
前端 贾公子16 分钟前
monorepo + Turborepo --- 开发应用程序
java·前端·javascript
奇文怪式39 分钟前
VSCode+arm-none-eabi-gcc交叉编译+CMake构建+OpenOCD(基于Raspberry Pico RP2040)
arm开发·ide·vscode·rp2040
不学会Ⅳ1 小时前
Mac M芯片搭建jdk源码环境(jdk24)
java·开发语言·macos
虫小宝1 小时前
高佣金返利平台监控体系建设:APM、链路追踪与佣金异常预警系统技术实现
java
sniper_fandc2 小时前
SpringBoot系列—入门
java·spring boot·后端
代码的余温3 小时前
Maven引入第三方JAR包实战指南
java·maven·jar
pianmian16 小时前
类(JavaBean类)和对象
java