为什么 gradle 存储库定义不起作用?
我不知道为什么 gradle 忽略了一个非常简单的 build.gradle 文件的“存储库”部分。我们位于防火墙后面,使用 JFrog 存储库来使用我们自己扫描的版本,而不是 Maven 中心。当我运行“gradle编译”时,我得到:
失败:构建失败并出现异常。
地点: 构建文件“/Users/exampleuser/src/example/tlp-platform-portal/build.gradle”行:2
出了什么问题: 在以下任何来源中均未找到插件 [id: 'org.springframework.boot', version: '2.6.3']:
- Gradle 核心插件(插件不在 'org.gradle' 命名空间中)
- 插件存储库(无法解析插件工件'org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.3') 在以下存储库中搜索: Gradle Central Plugin Repository
但是我的 build.gradle 没有提到 Gradlecentral;该文件看起来像附件。
--------构建.gradle---------------------
id 'org.springframework.boot' version '2.6.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'war'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
maven {
url 'https://example.jfrog.io/artifactory/penalty-maven-local'
credentials {
username = System.getenv('ARTIFACT_USERNAME')
password = System.getenv('ARTIFACT_PASSWORD')
}
}
maven {
url 'https://example.jfrog.io/artifactory/dha-gradle-plugin-remote-cache'
credentials {
username = System.getenv('ARTIFACT_USERNAME')
password = System.getenv('ARTIFACT_PASSWORD')
}
}
maven {
url 'https://example.jfrog.io/artifactory/plugins-release'
credentials {
username =System.getenv('ARTIFACT_USERNAME')
password =System.getenv('ARTIFACT_PASSWORD')
}
}
maven {
url "https://example.jfrog.io/example/libs-snapshot"
credentials {
username = System.getenv('ARTIFACT_USERNAME')
password = System.getenv('ARTIFACT_PASSWORD')
}
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
(lots more)
I'm at a loss why gradle is ignoring the 'repository' section of a pretty simple build.gradle file. We're behind a firewall, using a JFrog repository to use our own scanned versions of things, not Maven central. When I run 'gradle compile', I get:
FAILURE: Build failed with an exception.
Where:
Build file '/Users/exampleuser/src/example/tlp-platform-portal/build.gradle' line: 2What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.6.3'] 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 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.6.3')
Searched in the following repositories:
Gradle Central Plugin Repository
But my build.gradle has no mention of Gradle central; the file looks like the attached.
--------build.gradle---------------------
id 'org.springframework.boot' version '2.6.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'war'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
maven {
url 'https://example.jfrog.io/artifactory/penalty-maven-local'
credentials {
username = System.getenv('ARTIFACT_USERNAME')
password = System.getenv('ARTIFACT_PASSWORD')
}
}
maven {
url 'https://example.jfrog.io/artifactory/dha-gradle-plugin-remote-cache'
credentials {
username = System.getenv('ARTIFACT_USERNAME')
password = System.getenv('ARTIFACT_PASSWORD')
}
}
maven {
url 'https://example.jfrog.io/artifactory/plugins-release'
credentials {
username =System.getenv('ARTIFACT_USERNAME')
password =System.getenv('ARTIFACT_PASSWORD')
}
}
maven {
url "https://example.jfrog.io/example/libs-snapshot"
credentials {
username = System.getenv('ARTIFACT_USERNAME')
password = System.getenv('ARTIFACT_PASSWORD')
}
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
(lots more)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
插件解析的存储库必须在
settings.gradle
文件中配置,请参阅此处详细说明为什么使用自定义/私有存储库:https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositoriesRepositories for plugins resolution must be configured in the
settings.gradle
file, see detailed explanation why to use custom/private repositories here : https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositories