简体   繁体   中英

Intellij IDEA--How to modify build.gradle by Project Structure?

I need to use a 3rd library. I've tried open Project Structure and add libraries to that Module.

add library

modification revert

but when I click green"+" button in Gradle Tool Window, all modification disappear!

I cannot figure the reason, is that a BUG?

if not, how can I change gradle setting by Project Structure?

You should not add dependencies by using the Project Structure but instead declare them in your build.gradle file.

So you will have something like:

dependencies {
  compile group: 'org.lwjgl', name: 'lwjgl', version: '3.1.1'
}

If you do not have auto import enabled for your gradle project you have to refresh the project in the gradle toolbar.

Here is the relevant part for further reading: https://docs.gradle.org/current/userguide/dependency_management.html#sub:module_dependencies

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