简体   繁体   English

如何在Gradle IntelliJ项目中更改依赖关系?

[英]How to change dependency in Gradle IntelliJ project?

Suppose IntelliJ says that my project uses some version of the library, like this: 假设IntelliJ说我的项目使用了某些版本的库,如下所示:

在此处输入图片说明

If I press F4 I see the following entry: 如果按F4键, F4看到以下条目:

在此处输入图片说明

Where did it take it? 它去哪儿了? How to change the version? 如何更改版本?

You projects contains a file called build.gradle which contains dependencies that look something like this: 您的项目包含一个名为build.gradle的文件,该文件包含如下所示的依赖项:

 dependencies {
    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
    compile group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.7'
    compile group: 'ch.qos.logback', name: 'logback-classic', '1.0.13': logbackVersion
}

You can simply change the dependencies there. 您可以在那里简单地更改依赖关系。 Afterwards Gradle will fetch the new dependencies automatically, if activated. 之后,如果激活,Gradle将自动获取新的依赖项。 If not, use the "Refresh all gradle projects" button from the "Gradle" view (shown in the screenshot) 如果不是,请使用“渐变”视图中的“刷新所有gradle项目”按钮(如屏幕截图所示)

IntelliJ Gradle依赖项

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

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