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

如何让spring-boot-starter-parent仅使用指定版本的plexus-utils

统一plexus-utils版本的解决方案

首先,你在<properties>里配置plexus-utils.version无效,是因为spring-boot-starter-parent 2.7.6并没有定义这个属性,Maven无法识别并应用该配置。

针对你的需求,有两种可靠的处理方式:

1. 使用dependencyManagement锁定版本(推荐)

在pom.xml中添加<dependencyManagement>节点,强制所有模块(包括传递依赖)统一使用指定版本的plexus-utils,无需逐个排除旧版本:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>3.5.1</version>
        </dependency>
    </dependencies>
</dependencyManagement>

这个配置会覆盖所有传递依赖中的plexus-utils版本,Maven解析依赖时会统一采用3.5.1。你可以保留原来直接声明的<dependency>,也可以去掉——因为dependencyManagement已经锁定版本,传递依赖会自动使用该版本。

2. 排除特定传递依赖(按需使用)

如果某些依赖明确引入了旧版本的plexus-utils,且你想彻底停止这些旧版本的下载,可以找到对应的依赖,添加<exclusions>节点:
比如,假设依赖foo:bar引入了plexus-utils 1.5.8,可配置如下:

<dependency>
    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
        </exclusion>
    </exclusions>
</dependency>

你可以执行mvn dependency:tree命令,找到所有引入旧版本plexus-utils的依赖路径,再逐个排除。

验证版本是否生效

执行mvn dependency:tree | grep plexus-utils,查看输出结果,确认所有plexus-utils的版本均为3.5.1。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 08:25:16