看到这个答案:https://stackoverflow.com/a/3989936/325742
要修复此问题,请添加此 maven 依赖项休眠验证程序注释处理器。
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>4.1.0.Final</version>
</dependency>
这是该工件的最新稳定版本,从这里可以看出
查找依赖项的通用方法
假设您得到一个声明,指出未找到该类。NoClassDefFoundError
org.postgresql.Driver
使用Jarvana搜索可以像这样提供的依赖项:http://www.jarvana.com/jarvana/search?search_type=class&java_class=org.postgresql.Driver 它给出org.postgresql.Driver

-
将上述依赖项转换为 maven 依赖项格式:
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
通过像这样搜索:
g:“postgresql”和a:“postgresql”
(其中代表GroupID并代表artifactID)来确认上述内容在Maven Central上可用g
a
最后,将其添加到您的pom中.xml
使用 m2e 查找依赖项
如果您对所需的依赖项有一个大致的概念,或者可以在给定列表中找出所需的依赖项,那么m2e的依赖项搜索可能是向pom添加依赖项的最快方法.xml
步骤:
- 单击 pom 中的依赖项选项卡 (A.xml
- 单击添加 (B)
- 按 groupId/artifactId 搜索依赖项 (C)
- 双击搜索结果中所需的一个,将其直接添加到您的pom.xml(D)
在以下快照中标记的 A-D:
在 IntelliJ Idea 中查找依赖项
在IntelliJ中,查找依赖项要容易得多。您需要做的就是确保 Maven 中央存储库已被 IntelliJ 索引,如下所示:

然后,进入pom,做一个+(或一个+,如图所示),这就是你得到的:depTabAltInsert
如果您所在的类具有未解析的导入,则快速修复为您提供了一个选项,即通过在缺少的类/包上执行 + 来搜索和添加相应的 maven 存储库:AltEnter
真棒,我说!