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。

相关推荐
骇客野人2 分钟前
Java springboot里注解大全和使用指南
java·开发语言·spring boot
用户8307196840824 分钟前
Spring Boot 启动报错:OpenFeign 隐性循环依赖,排查了整整一下午
java·spring boot·spring cloud
恼书:-(空寄4 分钟前
事务绑定事件监听器的使用
java
星辰_mya8 分钟前
@SpringBootApplication 与 SPI 机制的终极解密
java·spring boot·spring
xdl25999 分钟前
【异常解决】Unable to start embedded Tomcat Nacos 启动报错
java·tomcat
是2的10次方啊11 分钟前
串行与并行:高并发系统里的优雅接口设计
java
qiuyuyiyang14 分钟前
SpringBoot中如何手动开启事务
java·spring boot·spring
sheji341616 分钟前
【开题答辩全过程】以 摩托车及配件售后管系统为例,包含答辩的问题和答案
java
我是苏苏23 分钟前
消息中间件RabbitMQ04:路由模式+死信队列的应用实践模板
java·开发语言
花无缺00026 分钟前
Java开发踩坑:一次线上性能优化案例
java·开发语言·人工智能·面试