程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Gradle 任务 runtimeOnlyDependenciesMetadata 失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决Gradle 任务 runtimeOnlyDependenciesMetadata 失败?

开发过程中遇到Gradle 任务 runtimeOnlyDependenciesMetadata 失败的问题如何解决?下面主要结合日常开发的经验,给出你关于Gradle 任务 runtimeOnlyDependenciesMetadata 失败的解决方法建议,希望对你解决Gradle 任务 runtimeOnlyDependenciesMetadata 失败有所启发或帮助;

我在没有明确提供版本的情况下添加了 runtimeOnly 依赖项(应该从 BOM 中获取)。

当我构建项目时,gradle 任务 runtimeOnlyDependencIEsMetadata 失败。 这是我收到的错误:

./gradlew build

Execution Failed for task ':service:bootJar'.
> Could not resolve all dependencIEs for configuration ':service:runtimeOnlyDependencIEsMetadata'.
   > Could not find com.lib.common:lib-jdbc-starter:.
     required by:
         project :service

Possible solution:
 - Declare repository provIDing the artifact,see the documentation at https://docs.gradle.org/current/userguIDe/declaring_repositorIEs.HTML

但是,当我显式添加版本时 runtimeOnly("com.lib.common:lib-jdbc-starter:1.1.0") 构建成功。如果我更改为 implementation("com.lib.common:lib-jdbc-starter"),也可以正常工作。

Kotlin 项目,这里是 build.gradle

buildscript {

    ext {
        springBootVersion = '2.3.1.RELEASE'
        springCloudVersion = 'Greenwich.SR6'
    }

    repositorIEs {
        maven { url "https://artifactory" }
        maven { url "https://repo.spring.io/milestone" }
        mavenCentral()
        jcenter()
    }

    dependencIEs {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }

}

plugins {
    ID "org.jetbrains.kotlin.jvm"
    ID "org.jetbrains.kotlin.plugin.spring" version "1.3.72"
    ID 'net.researchgate.release' version '2.7.0'
    ID "com.github.ben-manes.versions" version "0.20.0"
    ID 'com.avast.gradle.docker-compose' version "0.10.10"
}

apply plugin: 'groovy'
apply plugin: 'org.springframework.boot'
apply plugin: "kotlin-spring"
apply plugin: 'io.spring.dependency-management'
apply plugin: 'docker-compose'

repositorIEs {
    maven {
        url "https://artifactory"
        Metadatasources {
            mavenPom()
            artifact()
        }
    }
    mavenCentral()
    mavenLocal()
}

configurations.all {
    exclude group: 'org.projectlombok'
}

dependencIEs {
        // BOM
    implementation platform("com.lib.common:bom-dependencIEs:2.3.0")    
    
    runtimeOnly("com.lib.common:lib-jdbc-starter")
}

我该如何解决这个问题?

解决方法

您已经告诉 Gradle 将材​​料清单用于 implementation 配置,但将 lib-jdbc-starter 添加到 runtimeOnly 配置。您需要为要应用的每个配置声明平台。

你可以试试:

dependencies {
    // BOM
    runtimeOnly platform("com.lib.common:bom-dependencies:2.3.0")    
    
    runtimeOnly("com.lib.common:lib-jdbc-starter")
}

大佬总结

以上是大佬教程为你收集整理的Gradle 任务 runtimeOnlyDependenciesMetadata 失败全部内容,希望文章能够帮你解决Gradle 任务 runtimeOnlyDependenciesMetadata 失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:任务失败