My project is a JEE with jax-rs/resteasy implementation and I'm using resteasy validation with beans validations(hibernate-validator). When I try to build project by maven the error is:
employee.java:[6,10] package org.hibernate.validator.constraints.br does not exist
cannot find symbol class CPF
package br.com.example.dto;
import org.hibernate.validator.constraints.br.CPF;
public class Employee {
@NotBlank(message = "blank")
@CPF(message = "invalid")
private String cpf;
}
Pom.xml:
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-jakartaee8-with-tools</artifactId>
<version>${wildfly.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
If I remove @CPF validation everything works fine.
My question: why <artifactId>hibernate-validator</artifactId> that was declared inside of wildfly-jakartaee8-with-tools was not working for this country specific constraint?
Importing a
BOMdoes nothing (in terms of setting dependencies). You will still have to declare dependencies required for your project.But
BOMis pretty good for dependency versioning. In Maven you should set that BOM file as the parent of yourpom.xml:Or as a dependency in the
<dependencyManagement>section:And after that you don't need to specify any version of the dependency declared in the
<dependencyManagement>section of the parent pom file. For example:I also looked at the
wildfly-jakartaee8-with-toolsand didn't findhibernate-validator. You should check this out.