How do I import javax.validation into my Java SE project?

simpatico picture simpatico · Apr 25, 2010 · Viewed 29.8k times · Source

I'm trying to add constraints checking, as described here How to specify the cardinality of a @OneToMany in EclipseLink/JPA

Answer

Pascal Thivent picture Pascal Thivent · Apr 25, 2010

Here are the dependencies I'm using (with Maven):

<dependencies>
  <!-- Bean Validation API and RI -->
  <dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.0.0.GA</version>
  </dependency>
  <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>4.0.2.GA</version>
  </dependency>
</dependencies>

That you can get from this repository:

<repositories>
  <repository>
    <id>jboss</id>
    <name>JBoss repository</name>
    <url>http://repository.jboss.org/maven2</url>
  </repository>
</repositories>