You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Gradle/Gradlew列出指定BOM提供的所有属性?

Hey,刚好对这个问题很熟悉,给你几个靠谱的方法来找出你用的2.1.2.RELEASE版本Spring Boot BOM里的所有可用属性:

方法1:直接查看对应版本的官方POM文件

你提到的仓库master分支是最新开发版,和你用的2.1.2.RELEASE版本不一定匹配,得找对应标签的版本:

  • 找到Spring Boot仓库中v2.1.2.RELEASE的标签版本
  • 打开spring-boot-project/spring-boot-dependencies/pom.xml文件
  • 里面的<properties>节点下,就是这个BOM提供的所有属性(比如你知道的micrometer.version就在这里)
方法2:用Maven命令导出并查看

如果你本地有Maven环境,可以通过临时项目来提取属性:

  1. 创建一个临时的pom.xml文件,内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>temp-bom-check</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.1.2.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>
  1. 在这个文件所在目录执行命令:
mvn help:effective-pom -Doutput=effective-bom-properties.xml
  1. 打开生成的effective-bom-properties.xml,找到<properties>节点,里面就包含了这个BOM导入的所有属性。
方法3:用IDE直接查看

如果你用的是IntelliJ IDEA或者Eclipse这类IDE:

  • 在你的项目build.gradle里,找到spring-boot-dependencies的依赖声明
  • 按住Ctrl(Mac是Cmd)点击版本号2.1.2.RELEASE,IDE会自动下载并打开这个BOM的pom.xml文件
  • 直接找到<properties>节点,就能看到所有可用属性了

提醒一句:不同版本的Spring Boot BOM属性会有差异,一定要认准你使用的2.1.2.RELEASE版本,别搞错分支或标签哦~

内容的提问来源于stack exchange,提问作者anonk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:49:46