gpt4 book ai didi

java - 如何在 Gradle 中更新依赖项

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:17:16 26 4
gpt4 key购买 nike

任何人都可以告诉我如何在 gradle 中执行类似 maven install -U (更新依赖项)的操作。

我有问题我已将新的依赖项添加到我的 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')
}

新的依赖是:

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

在构建或项目同步期间,我的 IntelliJ(版本 14)甚至没有尝试下载这个新的依赖项(我使用的是 gradle 版本 2.5)

在 maven 项目中,IntelliJ 有类似下载 maven 依赖项的功能。但是对于 Gradle,我看不到这样的东西。这就像我的项目看起来像

谁能告诉我为什么我没有像 Maven 那样在项目列表中看到任何 *.jar?

enter image description here

最佳答案

使用 IntelliJ

在 Gradle 工具窗口中,单击刷新按钮。这是屏幕:

Gradle tool window

使用终端

您必须将这一行添加到您的build.gradle

apply plugin: 'idea'

接下来,如果您要添加一些依赖项并且想要同步 IntelliJ,您只需使用命令

gradle idea

关于java - 如何在 Gradle 中更新依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33594005/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com