IntelliJ下载Gradle依赖项,但在编译过程中找不到它们 [英] IntelliJ downloads Gradle dependencies but cannot find them during compile

查看:66
本文介绍了IntelliJ下载Gradle依赖项,但在编译过程中找不到它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ下载了build.gradle文件中列出的依赖项,它们显示在外部库中,但是IntelliJ在编译过程中找不到它们.它只是抛出一堆包x不存在"和无法解析符号".在项目结构"->模块"->依赖关系"下,它们都显示出来并列为编译".

IntelliJ downloaded the dependencies listed in my build.gradle file and they show up in the External Library, but IntelliJ fails to find them during compile. It just throws a bunch of "package x does not exist" and "cannot resolve symbol". Under the Project Structure -> Modules -> Dependencies they all show up and are listed as compile.

如果我尝试使用Gradle进行构建,那么它会成功,因此就只是IntelliJ.有什么想法吗?

If I try to build it with Gradle it's successful, so it's just IntelliJ. Any ideas?

如果重要的话,我正在Mac上使用它.

If it's important, I'm using this on a Mac.

推荐答案

找到了答案.IntelliJ将Main和Test视为与项目本身没有任何依赖关系的模块,并且所有库依赖关系都存储在项目级别.

Found the answer. IntelliJ was treating Main and Test as modules with no dependency related to the project itself and all of the library dependencies were stored at the project level.

我杀死了Main和Test作为模块,并对其进行了整理.

I killed off Main and Test as modules and it sorted itself out.

这篇关于IntelliJ下载Gradle依赖项,但在编译过程中找不到它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆