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。

相关推荐
zhangkaixuan45642 分钟前
Apache Paimon 写入流程
java·大数据·apache·paimon
Java爱好狂.1 小时前
分布式ID|从源码角度深度解析美团Leaf双Buffer优化方案
java·数据库·分布式·分布式id·es·java面试·java程序员
胡桃夹夹子1 小时前
存档111111111
java·开发语言
不会编程的小寒1 小时前
C++ 中string的用法
java·开发语言
乐悠小码1 小时前
Java设计模式精讲---02抽象工厂模式
java·设计模式·抽象工厂模式
数据的世界011 小时前
技术变革:为何C#与.NET是未来的开发方向
java·c#·.net
向上的车轮2 小时前
Actix Web适合什么类型的Web应用?可以部署 Java 或 .NET 的应用程序?
java·前端·rust·.net
脸大是真的好~2 小时前
黑马JAVAWeb-03 SpringBootWeb-分层解耦-三层架构-@SpringBootApplication注解-IOC控制反转-DI依赖注入
java
微露清风2 小时前
系统性学习C++-第十讲-stack 和 quene
java·c++·学习
一蓑烟雨任平生√2 小时前
两种上传图片的方式——91张先生
java·ossinsight