简体   繁体   English

Intellij中无法识别Gradle依赖项

[英]Gradle Dependencies not recognized in Intellij

I'm working on a Spring Boot Application using Gradle as a dependency management system or whatever. 我正在使用Gradle作为依赖管理系统或其他任何方式开发Spring Boot Application。

After adding a couple of dependencies to the build script and rebuilding the project, I would expect the build to have added those dependencies to the project. 在为构建脚本添加几个依赖项并重建项目之后,我希望构建将这些依赖项添加到项目中。 And yet, it does not. 但事实并非如此。 Cannot import those libraries. 无法导入这些库。 What step am I missing?? 我错过了什么步骤? I am a node.js developer and am used to just running an npm install to import dependencies. 我是node.js开发人员,我习惯于运行npm install来导入依赖项。

Here are the dependencies: 以下是依赖项:

dependencies {
    compile('org.mongodb:mongodb-driver:3.2.2')
    compile('org.springframework.boot:spring-boot-starter-data-mongodb')
}

Not that it matters, since they were not added to the project, but here are the eventual import statements: 并不重要,因为它们没有添加到项目中,但这里是最终的import语句:

import org.mongodb.MongoClient;
import org.springframework.data.mongodb.core.MongoTemplate;

Ok, so there is a right-hand menu bar, viz: 好的,所以有一个右侧菜单栏,即:

在此输入图像描述

And the gradle tab has a refresh option: gradle选项卡有一个刷新选项:

在此输入图像描述

That'll do it. 那就行了。 Ugh, ide's... 呃,ide ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM