为什么 gradle 存储库定义不起作用?

发布于 2025-01-09 18:17:25 字数 2211 浏览 0 评论 0原文

我不知道为什么 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: 2

  • What 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

貪欢 2025-01-16 18:17:25

插件解析的存储库必须在 settings.gradle 文件中配置,请参阅此处详细说明为什么使用自定义/私有存储库:https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositories

Repositories 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文