Hibernate Validator - Bean Validation 2.0 (JSR 380) Reference Implementation
Java Other
Permalink
Failed to load latest commit information.
annotation-processor [Jenkins release job] Preparing next development iteration Nov 15, 2017
build-config [Jenkins release job] Preparing next development iteration Nov 15, 2017
cdi [Jenkins release job] Preparing next development iteration Nov 15, 2017
distribution [Jenkins release job] Preparing next development iteration Nov 15, 2017
documentation [Jenkins release job] Preparing next development iteration Nov 15, 2017
engine [Jenkins release job] Preparing next development iteration Nov 15, 2017
integration [Jenkins release job] Preparing next development iteration Nov 15, 2017
jqassistant HV-1519 Exclude the test classes from the jqassistant rules Nov 3, 2017
modules [Jenkins release job] Preparing next development iteration Nov 15, 2017
osgi [Jenkins release job] Preparing next development iteration Nov 15, 2017
performance [Jenkins release job] Preparing next development iteration Nov 15, 2017
relocation [Jenkins release job] Preparing next development iteration Nov 15, 2017
src/main HV-1152 Avoiding overflowing boxes; less intensive outer border Mar 2, 2017
tck-runner [Jenkins release job] Preparing next development iteration Nov 15, 2017
test-utils [Jenkins release job] Preparing next development iteration Nov 15, 2017
.gitattributes HV-760 Adding .gitattributes to ensure consistent line ending style May 2, 2013
.gitignore Add Vim swap files to .gitignore Jul 4, 2017
.travis.yml Travis - Add -U option to mvn Jan 19, 2017
CONTRIBUTING.md HV-1464 Remove requirement for CLA Aug 29, 2017
README.md [Jenkins release job] README.md updated by release build 6.0.5.Final Nov 15, 2017
changelog.txt [Jenkins release job] changelog.txt updated by release build 6.0.5.Final Nov 15, 2017
copyright.txt HV-1466 Add Tadhg Pearson to the authors Nov 14, 2017
dco.txt HV-1464 Remove requirement for CLA Aug 29, 2017
license.txt BVAL-31 refactored some code, imported AnnotationFactory from annotat… Jan 7, 2009
pom.xml [Jenkins release job] Preparing next development iteration Nov 15, 2017
settings-example.xml HV-1187 Only use Groovy 2.4.8-SNAPSHOT for JDK 9 Dec 17, 2016

README.md

Hibernate Validator

Version: 6.0.5.Final - 15-11-2017

What is it?

This is the reference implementation of JSR-380 - Bean Validation 2.0. Bean Validation defines a metadata model and API for JavaBean as well as method validation. The default metadata source are annotations, with the ability to override and extend the meta-data through the use of XML validation descriptors.

Documentation

The documentation for this release is included in the docs directory of the distribution package or can be accessed online.

Release Notes

The full list of changes for this release can be found in changelog.txt.

System Requirements

JDK 1.8 or above.

Using Hibernate Validator

  • In case you use the distribution archive from the download site, copy dist/hibernate-validator-<version>.jar together with all jar files from dist/lib/required into the classpath of your application. For the purposes of logging, Hibernate Validator uses the JBoss Logging API, an abstraction layer which supports several logging solutions such (e.g. log4j or the logging framework provided by the JDK) as implementation. Just add a supported logging library to the classpath (e.g. log4j-<version>.jar) and JBoss Logging will delegate any log requests to that provider.

  • Add the following to your Maven or Ivy dependency list

      <dependency>
          <groupId>org.hibernate.validator</groupId>
          <artifactId>hibernate-validator</artifactId>
          <version>6.0.5.Final</version>
      </dependency>
    

    You also need an API and implementation of the Unified Expression Language. These dependencies must be explicitly added in an SE environment. In an EE environment they are often already provided.

      <dependency>
         <groupId>org.glassfish</groupId>
         <artifactId>javax.el</artifactId>
         <version>3.0.1-b08</version>
      </dependency>
    
  • Bean Validation defines integration points with CDI. If your application runs in an environment which does not provide this integration out of the box, you may use the Hibernate Validator CDI portable extension by adding the following dependency:

      <dependency>
         <groupId>org.hibernate.validator</groupId>
         <artifactId>hibernate-validator-cdi</artifactId>
         <version>6.0.5.Final</version>
      </dependency>
    
  • hibernate-validator-annotation-processor-<version>.jar is an optional jar which can be integrated with your build environment respectively IDE to verify that constraint annotations are correctly used. Refer to the online documentation for more information.

Licensing

Hibernate Validator itself as well as the Bean Validation API and TCK are all provided and distributed under the Apache Software License 2.0. Refer to license.txt for more information.

Build from Source

You can build Hibernate Validator from source by cloning the git repository git://github.com/hibernate/hibernate-validator.git. You will also need a JDK 8 and Maven 3 (>= 3.3.1). With these prerequisites in place you can compile the source via:

mvn -s settings-example.xml clean install

There are more build options available as well. For more information refer to Contributing to Hibernate Validator.

Build on JDK 9

To build Hibernate Validator with JDK 9, export the following environment variable:

export MAVEN_OPTS="--add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-modules=java.xml.bind"

Then the build can be started like this:

mvn -s settings-example.xml clean install

Here are the reasons why we added the various build options:

  • add-opens java.security: required by wildfly-maven-plugin:execute-commands (for the WildFly integration tests and the TCK runner running in container mode)
  • add-opens java.lang: required by JRuby for Asciidoc processing
  • add-modules java.xml.bind: required by the forbiddenapis Maven plugin

Continuous Integration

The official Continuous Integration service for the project is hosted on ci.hibernate.org.

We provide a .travis.yml file so that you can enable CI for your GitHub fork by enabling the build in your Travis CI account.

Hibernate Validator URLs