Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@ JDK 1.6 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. You can switch the slf4j binding jars for log4j
(log4j-<version>.jar and slf4j-log4j12-<version>.jar) with the slf4j binding files of your choice. See http://www.slf4j.org/manual.html
In case you are using Java 5 you have to also include all the jar files from the dist/lib/jdk5 directory.
The jar files contain the classes needed for JAXB. If you don't use the xml configuration and XML configuration
is disabled via Configuration.ignoreXmlConfiguration the jar files from the dist/lib/jdk5 directory don't have to be added.

or
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 (Hibernate Validator can be found in the [JBoss Maven repository](http://repository.jboss.org/nexus/content/groups/public-jboss)):

Expand Down
4 changes: 2 additions & 2 deletions archetype/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@

<!-- Need to list out optional dependencies here again in order to include them via assembly dependency set -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
Expand Down
2 changes: 0 additions & 2 deletions distribution/src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
<dependencySet>
<outputDirectory>dist/lib/optional</outputDirectory>
<includes>
<include>org.slf4j:slf4j-api</include>
<include>org.slf4j:slf4j-log4j12</include>
<include>log4j:log4j</include>
<include>joda-time:joda-time</include>
<include>org.hibernate.javax.persistence:hibernate-jpa-2.0-api</include>
Expand Down
49 changes: 33 additions & 16 deletions documentation/src/main/docbook/en-US/modules/gettingstarted.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,22 @@
</itemizedlist>

<section id="validator-gettingstarted-createproject">
<title>Setting up a new Maven project</title>
<title>Project set up</title>

<para>In order to use Hibernate Validator within an existing Maven
project, simply add the following dependency to your
<filename>pom.xml</filename>:<example>
<title>Maven dependency of Hibernate Validator</title>

<programlisting>&lt;dependency&gt;
&lt;groupId&gt;org.hibernate&lt;/groupId&gt;
&lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
&lt;version&gt;&version;&lt;/version&gt;
&lt;/dependency&gt;</programlisting>
</example></para>

<para>Start by creating new Maven project using the Maven archetype plugin
as follows:</para>
<para>Alternatively, you can start by creating a sample project using
Hibernate Validator's Quickstart Maven archetype as follows:</para>

<para><example>
<title>Using Maven's archetype plugin to create a sample project using
Expand All @@ -88,16 +100,21 @@

<para><programlisting>mvn test</programlisting> Maven will compile the
example code and run the implemented unit tests. Let's have a look at the
actual code.</para>

<note>
<para>From version 4.2.0.Beta2, the maven command <command>mvn
archetype:create</command> will be no longer supported and will fail.
You should use the command described in the above listing. If you want
more details, look at <ulink
url="http://maven.apache.org/archetype/maven-archetype-plugin/"> Maven
Archetype plugin</ulink> page.</para>
</note>
actual code in the next section.</para>

<tip>
<para>For the purposes of logging, Hibernate Validator uses the JBoss
Logging API. This is an abstraction layer which supports several known
logging solutions (e.g. log4j or the logging framework provided by the
JDK) as implementation. Just add your preferred logging library to the
classpath and all log requests from Hibernate Validator will
automatically be delegated to that logging provider.</para>

<para>Alternatively, you can explicitely specify a provider using the
system property <varname>org.jboss.logging.provider</varname>. Supported
values currently are <varname>jboss</varname>, <varname>jdk</varname>,
<varname>log4j</varname> and <varname>slf4j</varname>.</para>
</tip>
</section>

<section id="validator-gettingstarted-createmodel">
Expand Down Expand Up @@ -282,10 +299,10 @@ public class CarTest {

<para>That concludes our 5 minute tour through the world of Hibernate
Validator. Continue exploring the code examples or look at further
examples referenced in <xref linkend="validator-further-reading" />. To
examples referenced in <xref linkend="validator-further-reading"/>. To
deepen your understanding of Hibernate Validator just continue reading
<xref linkend="validator-usingvalidator" />. In case your application has
<xref linkend="validator-usingvalidator"/>. In case your application has
specific validation requirements have a look at <xref
linkend="validator-customconstraints" />.</para>
linkend="validator-customconstraints"/>.</para>
</section>
</chapter>
4 changes: 2 additions & 2 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static Collection<JavaArchive> bundleHibernateValidatorWithDependencies(b
public static Collection<JavaArchive> bundleLoggingDependencies() {
return DependencyResolvers.use( MavenDependencyResolver.class )
.loadMetadataFromPom( "pom.xml" )
.artifact( "org.slf4j:slf4j-log4j12" )
.artifact( "log4j:log4j" )
.resolveAs( JavaArchive.class );
}
}
Expand Down
22 changes: 12 additions & 10 deletions performance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -115,8 +107,8 @@
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
<properties>
Expand All @@ -137,6 +129,11 @@
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<properties>
<validator.version>HV 4.2.0.Final</validator.version>
Expand All @@ -156,6 +153,11 @@
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
<properties>
<validator.version>HV 4.1.0.Final</validator.version>
Expand Down
17 changes: 3 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
<properties>
<!-- see http://maven.apache.org/general.html -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.6.1</slf4j.version>
<org.codehaus.mojo.chronos.version>1.0-beta-3</org.codehaus.mojo.chronos.version>
</properties>

Expand All @@ -111,19 +110,9 @@
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
Expand Down
18 changes: 4 additions & 14 deletions tck-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
Expand Down Expand Up @@ -313,14 +303,14 @@
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
</artifactItem>
Expand Down