简体   繁体   中英

Gradle Dependencies not recognized in Intellij

I'm working on a Spring Boot Application using Gradle as a dependency management system or whatever.

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.

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 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:

在此输入图像描述

That'll do it. Ugh, ide's...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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