Using the Annotation Processor - Apache Ant - Maven
8.4.1.3. Maven There are several options for integrating the annotation processor with Apache Maven. Generally it is sufficient to add the Hibernate Validator Annotation Processor as dependency to your project: Example 8.3. Adding the HV Annotation Processor as dependency ... org.hibernate hibernate-validator-annotation-processor 4.1.0.Final compile ... The processor will then be executed automatically by the compiler. This basically works, but comes with the disadavantage that in some cases messages from the annotation processor are not displayed (see MCOMPILER-66). Another option is using the Maven Annotation Plugin. At the time of this writing the plugin is not yet available in any of the well-known repositories. Therefore you have to add the project's own repository to your settings.xml or pom.xml: Example 8.4. Adding the Maven Annotation Plugin repository ... maven-annotation-plugin-repo http://maven-annotation-plugin.googlecode.com/svn/trunk/mavenrepo ... Now disable the standard annotation processing performed by the compiler plugin and configure the annotation plugin by specifying an execution and adding the Hibernate Validator Annotation Processor as plugin dependency (that way the AP is not visible on the project's actual classpath): Example 8.5. Configuring the Maven Annotation Plugin ... maven-compiler-plugin 1.6 1.6 -proc:none org.bsc.maven maven-processor-plugin 1.3.4 process process process-sources org.hibernate hibernate-validator-annotation-processor 4.1.0.Final compile ...