gpt4 book ai didi

gradle - Gradle依赖管理插件

转载 作者:行者123 更新时间:2023-12-03 03:59:18 24 4
gpt4 key购买 nike

我正在尝试运行以下最小的gradle构建文件,包括依赖项管理插件:

buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}

plugins {
id "java"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}

但是随后运行gradle失败:
* What went wrong:
Plugin [id: 'io.spring.dependency-management', version: '1.0.4.RELEASE'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'io.spring.dependency-management:io.spring.dependency-management.gradle.plugin:1.0.4.RELEASE')
Searched in the following repositories:
Gradle Central Plugin Repository

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.5.1/userguide/command_line_interface.html#sec:command_line_warnings

gradle文件中是否缺少依赖项?

最佳答案

找不到插件,因为您在构建脚本中定义了存储库并尝试在其外部使用插件。删除构建脚本或为构建文件添加存储库。
(在构建脚本范围内可以访问在构建脚本中定义的依赖项和存储库)

例:

plugins {
id "java"
id "io.spring.dependency-management" version "1.0.4.RELEASE"
}

repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}

关于gradle - Gradle依赖管理插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49366525/

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