简体   繁体   English

如何在Gradle中更新依赖项

[英]How to update dependencies in Gradle

Can any body can tell me how can I do something like maven install -U (update dependencies) in gradle. 任何机构都可以告诉我如何在gradle中执行类似maven install -U (更新依赖项)的操作。

I have problem I have added new dependency to my build.gradle file 我有问题我已经在build.gradle文件中添加了新的依赖项

dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile("org.springframework.boot:spring-boot-starter-security")
    runtime('com.h2database:h2')
    testCompile('org.springframework.boot:spring-boot-starter-test') 
}

New dependency is: 新的依赖是:

compile("org.springframework.boot:spring-boot-starter-security")

And during build or project synchronize my IntelliJ (version 14) is not even trying download this new dependency (I'm using gradle version 2.5) 在构建或项目同步期间,我的IntelliJ(版本14)甚至没有尝试下载这个新的依赖项(我使用的是gradle版本2.5)

In maven project IntelliJ had something like download maven dependencies. 在maven项目中,IntelliJ有类似下载maven依赖项的东西。 But for Gradle I don't see anything like this. 但是对于Gradle我没有看到这样的东西。 This is like my project looks like 这就像我的项目一样

And can any body tell me why I don't see any *.jar on project list like maven does? 并且任何人都可以告诉我为什么我在maven的项目列表中看不到任何* .jar吗?

在此输入图像描述

Using IntelliJ 使用IntelliJ

In the Gradle tool window, click refresh button. 在“Gradle”工具窗口中,单击“刷新”按钮。 Here is the screen: 这是屏幕:

Gradle工具窗口

Using terminal 使用终端

You must add to your build.gradle this line 您必须在此行中添加build.gradle

apply plugin: 'idea'

And next if you are adding some dependencies and you want synchronize IntelliJ, you just use command 接下来,如果要添加一些依赖项并且想要同步IntelliJ,则只需使用命令

gradle idea

If any one have problem with finding Gradle Tool Window it's in: 如果任何人在查找Gradle Tool Window时遇到问题,那就是:

View | 查看| Tool Windows | 工具窗口| Gradle 摇篮

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

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