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

Spring Boot中Pact Testing问题:IntelliJ无法安装au.com.dius.pact:consumer:4.6.1

解决Pact Consumer依赖安装问题(Gradle + IntelliJ)
  • 检查仓库配置
    确保你的项目已配置Maven Central仓库,Pact官方包托管在此仓库:
    在项目根目录的build.gradle中添加:

    repositories {
        mavenCentral()
    }
    

    若使用Gradle 7及以上版本,还需在settings.gradle中确认仓库配置:

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            mavenCentral()
        }
    }
    
  • 确认依赖与项目环境兼容
    你配置的au.com.dius.pact.consumer:junit5:4.6.1坐标正确,但该版本要求JDK 8+、JUnit 5.6+。如果项目的JDK或JUnit版本过低,会导致依赖无法正常加载。可以尝试切换到更稳定的新版本(如4.10.0),或者升级项目的JDK/JUnit版本。

  • 强制刷新Gradle依赖
    在IntelliJ中点击Gradle工具栏的刷新按钮(大象图标旁的箭头),或在终端执行命令:

    ./gradlew clean build --refresh-dependencies
    
  • 清理IntelliJ缓存
    点击File -> Invalidate Caches...,选择Invalidate and Restart,重启IDE后重新同步Gradle项目。

  • 检查网络与代理设置
    若处于公司内网,需确认IntelliJ和Gradle的代理配置正确,能够正常访问Maven Central。可在File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy中检查并调整代理设置。

内容的提问来源于stack exchange,提问作者Subhojit-Dey

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 09:43:18