ubuntu17.10 idea 导入项目,maven依赖导入失败问题

本文介绍了解决IntelliJ IDEA中Maven项目依赖无法自动加载的问题。通过调整文件权限、清理项目并重新配置自动导入设置,最终成功解决了依赖未能正确加载至项目的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参照网上的教程,maven reimport,设置import maven projects automatically,maven clean,maven package,maven install等之后,在External Libaries处还是没有把jar包引进来的问题。

然后查看maven控制台,发现是文件加载之类的问题,遂觉得是权限设置问题,然后查看maven repository的权限,发现为755权限(本文只说明本人解决问题的过程,如果有不懂的知识点,请自行google之),猜想会不会是我的repository没有这个jar,然后从网上dowload idea没有写入的权限呢,然后修改权限为777,再执行maven reimport,发现还是不能。

然后在stackoverflower看到这个回答
原文链接

点赞最高的用户的回答

IntelliJ should download and add all your dependencies to the
project’s classpath automatically as long as your POM is compliant and
all the dependencies are available.

When importing Maven projects into IntelliJ an information box usually
comes up asking you if you want to configure Auto-Import for Maven
projects. That means that if you make any changes to your POM those
changes will be loaded automatically.

You can enable such feature going to File > Settings > Maven >
Importing, there is a checkbox that says “Import Maven projects
automatically”.

If that doesn’t help, then I would suggest to make a full clean-up and
start again:

Close your project window (and IntelliJ) and remove all *.iml files
and all .idea folders (there should be one per module) Run mvn clean
install from the command line Re-import the project into IntelliJ and
pay attention when it asks you to enable auto-import IntelliJ 2016
Update:

The Import Maven Projects automatically setting has been moved to
Build, Execution, Deployment > Build Tools > Maven > Importing in your
IntelliJ preferences.

发现idea是要把maven依赖相关的内容写在.iml或者是.idea里面,于是猜测是不是当前用户没有对这两个文件写入的权限,于是查询,真没有!跟之前的repository一样是755权限,于是修改,再参照上面那个用户的回答,关闭idea,到目录底下删除.idea 和 *.iml,然后设置项目目录和其所有子目录及文件的权限为777,重新启动idea导入项目,maven 依赖倒入成功!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值