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

无法启动Open Liberty服务器:执行mvn liberty:dev时依赖解析失败

问题

在Ubuntu 18.04系统上执行mvn liberty:dev启动Open Liberty服务器时,出现以下错误:

Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.7.1:dev (default-cli) on project hello-world: org.apache.maven.plugin.MojoExecutionException: Unable to resolve artifact: io.openliberty.features:io.openliberty.jakarta.persistence.base-3.1:23.0.0.3: Failure to find io.openliberty.features:io.openliberty.jakarta.persistence.base-3.1:esa:23.0.0.3 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

当前环境信息:

$ java --version
openjdk 11.0.18 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)

$ mvn -v
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.18, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: cs_CZ, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-146-generic", arch: "amd64", family: "unix"

此前服务器可正常启动,未修改任何配置,寻求解决办法。

解决方法
  • 强制Maven更新依赖,重新拉取缺失组件:
    执行命令:mvn liberty:dev -U
    -U参数会忽略本地缓存的更新间隔,直接从远程仓库重新获取依赖。

  • 清理本地Maven仓库中该组件的缓存:

    1. 找到本地Maven仓库对应路径(默认是~/.m2/repository/io/openliberty/features/io.openliberty.jakarta.persistence.base-3.1/23.0.0.3)
    2. 删除该目录下所有文件,尤其是*.lastUpdated缓存文件
    3. 重新执行mvn liberty:dev
  • 检查项目pom.xml的仓库配置:
    如果中央仓库无该组件,需添加Open Liberty官方仓库到pom.xml的<repositories>节点:

    <repository>
        <id>openliberty-maven</id>
        <name>Open Liberty Maven Repository</name>
        <url>https://repo1.maven.org/maven2/io/openliberty/</url>
        <layout>default</layout>
    </repository>
    
  • 调整插件或Open Liberty版本:
    若23.0.0.3版本组件存在问题,可尝试将liberty-maven-plugin降级到3.6.x版本,或在pom.xml中指定更低版本的Open Liberty特性(比如22.0.0.12版本的jakarta.persistence.base-3.1)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.26 02:05:16