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

在pom.xml中添加Hibernate ORM 7.0.0-SNAPSHOT依赖时缺失构件

解决Hibernate ORM 7.0.0-SNAPSHOT依赖缺失问题

核心问题分析

你遇到的Missing artifact org.hibernate.orm:hibernate-core:jar:7.0.0-SNAPSHOT错误,主要是仓库URL配置错误导致的,其次可能涉及Maven快照缓存的问题。

具体修正步骤

1. 修正仓库URL

你第一次配置的仓库URL多了后缀/org/hibernate/orm/,Maven需要从Sonatype快照仓库的根目录开始查找依赖,正确的仓库配置应该是:

<repositories>
    <repository>
        <id>hibernate-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <!-- 可选:强制Maven每次更新快照,避免缓存旧数据 -->
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

你第二次尝试的Profile配置中仓库URL是正确的,但要确保依赖的groupId和artifactId无误(Hibernate 6.x+版本确实使用org.hibernate.orm:hibernate-core)。

2. 清理Maven本地缓存

如果仓库配置正确后仍报错,可能是本地Maven缓存了无效的快照记录,执行以下命令强制更新:

mvn clean install -U

-U参数会让Maven忽略本地缓存,重新从远程仓库拉取最新的快照依赖。

3. 确认快照版本可用性

Hibernate 7.0.0-SNAPSHOT是开发中的预览版本,可能尚未发布到Sonatype快照仓库。你可以手动检查Sonatype快照仓库中org/hibernate/orm/hibernate-core路径下是否存在该版本的文件。

完整正确的pom.xml示例

<properties>
    <hibernate-core.version>7.0.0-SNAPSHOT</hibernate-core.version>
</properties>

<repositories>
    <repository>
        <id>hibernate-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.hibernate.orm</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate-core.version}</version>
    </dependency>
</dependencies>

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.27 07:50:28