See this answer : https://stackoverflow.com/a/3989936/325742
To fix, Add this maven dependency Hibernate Validator Annotation Processor.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>4.1.0.Final</version>
</dependency>
That's the latest stable version of that artifact, as seen from here
Generic way of finding a dependency
Let's say that you got a a NoClassDefFoundError
stating that the class org.postgresql.Driver
was not found.
Use Jarvana to search for a dependency that can provide org.postgresql.Driver
like so : http://www.jarvana.com/jarvana/search?search_type=class&java_class=org.postgresql.Driver which gives
Translate the above dependency into maven dependency format :
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
Confirm that the above is available at Maven Central by searching like this :
g:"postgresql" AND a:"postgresql"
(where g
stands for GroupID and a
stands for artifactID)
Finally, add it to your pom.xml
Finding Dependencies using m2e
If you have an approximate idea of the dependency needed or can figure out the one you need given a list, then m2e's dependency search can be the quickest way of adding a dependency to your pom.xml
Steps :
- Click on the Dependencies tab (A) in your pom.xml
- Click on Add (B)
- Search for the dependency by groupId/artifactId (C)
- Double click the required one from the search results to have it added directly to your pom.xml (D)
A-D marked in the following snapshot :
Finding dependencies in IntelliJ Idea
In IntelliJ, looking up a dependency is much easier. All you need to do, is to make sure that the maven central repo has been indexed by IntelliJ like so:
And then, go into the pom, do a dep+Tab (or an Alt+Insert as shown here), and this is what you get:
If you are in a class which has an unresolved import, then the quick fix gives you an option of searching and adding the corresponding maven repo by doing an Alt+Enter on the missing Class/Package:
Awesome I say !
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…