build.gradle - mavenBom from spring dependency-management Gradle plugin does not add bom to gradle module file - Stack Overflow

I have a simple library project A and I use spring dependency management.dependencyManagement {imports

I have a simple library project A and I use spring dependency management.

dependencyManagement {
        imports {
            mavenBom("io.grpc:grpc-bom:$grpcBomVersion")
            mavenBom("com.google.protobuf:protobuf-bom:$protobufBomVersion")
        }
    }

Generated pom file fot this project is ok, but generated gradle 'module' file, which is used by default if I import my project A into project B does not contain following code snippet:

"dependencies": [
        {
          "group": "io.grpc",
          "module": "grpc-bom",
          "version": {
            "requires": "1.58.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },
        {
          "group": "com.google.protobuf",
          "module": "protobuf-bom",
          "version": {
            "requires": "3.24.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },

This behavior causes that** I need to manually add boms to project B**(project B imports library project A): implementation(platform("io.grpc:grpc-bom:$grpcBomVersion")) implementation(platform("com.google.protobuf:protobuf-bom:$protobufBomVersion"))

if I use platform for library project A:

implementation(platform("io.grpc:grpc-bom:$grpcBomVersion"))
implementation(platform("com.google.protobuf:protobuf-bom:$protobufBomVersion"))

then all is ok, generated gradle .module file contains mentioned lines:

"dependencies": [
        {
          "group": "io.grpc",
          "module": "grpc-bom",
          "version": {
            "requires": "1.58.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },
        {
          "group": "com.google.protobuf",
          "module": "protobuf-bom",
          "version": {
            "requires": "3.24.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },

So no need to manually import boms to project B(project B imports library project A): implementation(platform("io.grpc:grpc-bom:$grpcBomVersion")) implementation(platform("com.google.protobuf:protobuf-bom:$protobufBomVersion"))

But I don't like to use platform gradle notation in project A, cause in this case I have different versions of same transitive dependencies in project A. I don't want to exclude them manually. When I use dependency-management plugin in project A - I see that my duplicates of transitive dependencies are gone , so prefer to use dependency-management plugin instead of platform, but it causes missed boms in generated gradle .module file

I have a simple library project A and I use spring dependency management.

dependencyManagement {
        imports {
            mavenBom("io.grpc:grpc-bom:$grpcBomVersion")
            mavenBom("com.google.protobuf:protobuf-bom:$protobufBomVersion")
        }
    }

Generated pom file fot this project is ok, but generated gradle 'module' file, which is used by default if I import my project A into project B does not contain following code snippet:

"dependencies": [
        {
          "group": "io.grpc",
          "module": "grpc-bom",
          "version": {
            "requires": "1.58.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },
        {
          "group": "com.google.protobuf",
          "module": "protobuf-bom",
          "version": {
            "requires": "3.24.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },

This behavior causes that** I need to manually add boms to project B**(project B imports library project A): implementation(platform("io.grpc:grpc-bom:$grpcBomVersion")) implementation(platform("com.google.protobuf:protobuf-bom:$protobufBomVersion"))

if I use platform for library project A:

implementation(platform("io.grpc:grpc-bom:$grpcBomVersion"))
implementation(platform("com.google.protobuf:protobuf-bom:$protobufBomVersion"))

then all is ok, generated gradle .module file contains mentioned lines:

"dependencies": [
        {
          "group": "io.grpc",
          "module": "grpc-bom",
          "version": {
            "requires": "1.58.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },
        {
          "group": "com.google.protobuf",
          "module": "protobuf-bom",
          "version": {
            "requires": "3.24.0"
          },
          "attributes": {
            ".gradle.category": "platform"
          },
          "endorseStrictVersions": true
        },

So no need to manually import boms to project B(project B imports library project A): implementation(platform("io.grpc:grpc-bom:$grpcBomVersion")) implementation(platform("com.google.protobuf:protobuf-bom:$protobufBomVersion"))

But I don't like to use platform gradle notation in project A, cause in this case I have different versions of same transitive dependencies in project A. I don't want to exclude them manually. When I use dependency-management plugin in project A - I see that my duplicates of transitive dependencies are gone , so prefer to use dependency-management plugin instead of platform, but it causes missed boms in generated gradle .module file

Share Improve this question asked Nov 16, 2024 at 16:30 Alexandra ZverkovichAlexandra Zverkovich 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

This is not possible with the Spring Dependency Management plugin. See the following issue for details: https://github/spring-gradle-plugins/dependency-management-plugin/issues/342

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745652335a4638338.html

相关推荐

  • 非nvidia卡torchvision报错修复: operator torchvision::nms does not exist

    在Ascend 910b上安装vllm, 会自动把torchaudio和torchvision安装上去.安装前代码语言:shell复制pip list | grep torchtorch

    1小时前
    00
  • 电脑开机会默认一件GHOST

    关于电脑开机会自己重装系统 前段时间电脑一开机就遇到会自己ghost的问题,而且一直再重复同样的操作,我点击restart的时候到开启页面又会自动ghost,而且此页面停留

    57分钟前
    00
  • AlignRAG:浙江大学提出的可泛化推理对齐框架,助力 RAG 系统解决推理失配问题

    近年来,检索增强生成(Retrieval-Augmented Generation, RAG)成为知识驱动文本生成的核心范式。然而,现有的 RAG 系统在推理过程中常常出现“推理失配”问题,即模型的推理路径与检索到的证据不一致,导致生成内容

    57分钟前
    00
  • 最简 Odoo 部署方法:Websoft9 企业应用托管平台

    传统方式部署 Odoo 通常依赖 Docker 技术,主要分为以下步骤:1 . 安装 Docker需在服务器上安装 Docker 引擎,涉及操作系统兼容性检查、依赖包安装、镜像源配置等操作。代码语言:bash复制 # 以 Ubu

    50分钟前
    00
  • ascend pytorch 踩坑.

    在910b上安装pytorch 和 pytorch_npu, 因为后续准备装vllm, 所以torch_npu是特殊的版本.代码语言:shell复制pip install torch==2.5.1 --extra-index pip in

    47分钟前
    00
  • 开源在线考试系统

    看到调问已经开始扩展在线考试的场景,试了一下,发现在线考试的基本能力都已经支持了。主要是考试中的各种计分功能,包括对每道题的选项设置分值计算、考试时间限制等,和官方了解了一下,考试中的其他各项能力也在逐步完善,有需求可以随时

    46分钟前
    00
  • Power BI 无公式实现帕累托图表

    帕累托分析(Pareto Analysis),也被称为8020法则、关键少数法则,是一种常用的管理工具,用于识别和处理影响业务的主要因素。看到李伟坚老师在Excel使用Vega实现了花式帕累托(参考:Excel 零公式实现高级帕累托图表)

    44分钟前
    00
  • Go 语言 Mock 实践

    Mock 是软件测试中的一项关键技术,尤其在单元测试领域,可谓是“顶梁柱”般的存在,几乎不可或缺。它通过模拟真实对象的行为,使我们能在不依赖外部系统的情况下,专注测试代码的核心逻辑。对于测试开发、自动化测试,乃至性能测试中的某些场景,合理使

    42分钟前
    00
  • 如何快速判断 Flutter 库是否需要适配鸿蒙?纯 Dart 库无需适配!

    在鸿蒙开发中,选择合适的 Flutter 库至关重要。纯 Dart 库因其跨平台特性,无需适配即可直接使用。但对于新手来说,如何判断一个库是否为纯 Dart 库呢?本文将为你提供清晰的判断方法和实用技巧。一、检查 pubspec.yaml

    41分钟前
    00
  • 什么是docker?它是如何工作的?

    想象一个场景,你要部署一个服务,然后它对环境有很多依赖,不同的操作系统又是不同的需求,而且还可能遇到有些源不能使用,又得一番折腾,折腾完上线后,假设要在新的环境再来一套,又得再来一遍。那么有没有什么办法可以解决呢?有办法,docker就是干

    34分钟前
    00
  • 重装系统只影响C盘吗?深入解析系统重装的全过程

    重装系统只影响C盘吗?深入解析系统重装的全过程 在计算机的日常使用中,重装系统是一个常见的操作,尤其是在系统出现故障、感染病毒或需要优化系统性能时。然而,许多用户对于重装系统的具体过程和影响存在误解,认为重装系统仅仅是对C盘进行清空和重置

    28分钟前
    10
  • 拥抱国产化:转转APP的鸿蒙NEXT端开发尝鲜之旅

    本文由转转技术团队赵卫兵分享,原题“鸿蒙新篇章:转转 APP 的 HarmonyOS Next 开发之旅”,下文进行了排版优化和内容修订。1、引言2023 年在华为开发者大会(HDC.Together)上,除了面向消费者的 HarmonyO

    25分钟前
    00
  • Windows Server20192022 Evaluation评估版未激活导致关机问题

    摘要:在安装Windows Server 20192022后,会出现系统版本为 Evaluation 评估版情况,如提示Windows许可证已到期,就

    21分钟前
    00
  • 实现一个 MySQL 配置对比脚本需要考虑哪些细节?

    作者:李彬,爱可生 DBA 团队成员,负责项目日常问题处理及公司平台问题排查。爱好有亿点点多,吉他、旅行、打游戏爱可生开源社区出品,原创内容未经授权不得随意使用,转载请联系小编并注明来源。本文约 1500 字,预计阅读需要 3 分钟。引言想

    20分钟前
    00
  • windows新建open ai密钥

    api链接 openai的api需要付费才能使用但好像系统变量不知道为啥用不了打印出来,获取到的是None可以用了

    18分钟前
    00
  • 子网掩码是怎么“掩”的?用积木教你彻底搞懂!

    子网掩码是怎么“掩”的?用积木教你彻底搞懂!前言肝文不易,点个免费的赞和关注,有错误的地方请指出,看个人主页有惊喜。作者:神的孩子都在歌唱你是不是也曾被“子网掩码”这个术语搞得晕头转向?明明是学网络的第一步,却像是打开了数学世界的大门:2

    14分钟前
    00
  • 1.54G 雨晨 26100.3775 Windows 11 IoT 企业版 LTSC 24H2 极速版

    精简AERO外主题并增加一套壁纸主题(默认启用)误杀导致功能界面空白、因WMIC被默认移除系统可能会多次重启。 拒止连接 www.5909 拒止连接 www.mnpc 拒止连接 quark 拒止

    14分钟前
    00
  • ​2025 轻松部署 Odoo 18 社区版

    随着 Odoo 18 社区版的发布,越来越多的企业希望借助这款开源 ERP 系统实现数字化转型。本文将深入解析传统部署方式的底层逻辑,并揭示如何通过自动化工具实现零门槛快速部署。一、手工部署 Odoo 18 技术全解 Docker 环境搭建

    11分钟前
    00
  • 设计模式:工厂方法模式(Factory Method)(2)

    当年做一个项目时,还不懂什么是设计模式,仅仅是按照经验完成了需求。回头看看,就是暗合桥接模式。但是,在整个需求实现过程中,甲方需要我在已经设计好的标准业务逻辑中添加非标的需求,因为,在他们眼里,从业务角度来看,是自然的拓展。如果当年我知道还

    2分钟前
    00
  • win11家庭版改为专业版

    找到“我的电脑”--“设置”--“系统”--“激活”--“更改密钥” 输入密钥“G49HN-9YQCT-684C3-R7T3F-3DBQB 即可成功。

    1分钟前
    00

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信