SeamFramework.orgCommunity Documentation
This chapter describes the steps required to getting started with the Seam Validation Module.
Not very much is needed in order to use the Seam Validation Module. Just be sure to run on JDK 5 or later, as the Bean Validation API and therefore this Seam module are heavily based on Java annotations.
The recommended way for setting up Seam Validation is using Apache Maven. The Seam Validation
Module artifacts are deployed to the JBoss Maven repository. If not yet
the case, therefore add this repository to your
settings.xml
file (typically in
~/.m2/settings.xml
) in order to download the
dependencies from there:
Example 74.1. Setting up the JBoss Maven repository in settings.xml
...
<profiles>
<profile>
<repositories>
<repository>
<id>jboss-public</id>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>jboss-public</activeProfile>
</activeProfiles>
...
General information on the JBoss Maven repository is available in
the JBoss
community wiki, more information on Maven's
settings.xml
file can be found in the settings reference.
Having set up the repository you can add the Seam Validation Module
as dependency to the pom.xml
of your project. As most
Seam modules the validation module is split into two parts, API and
implementation. Generally you should be using only the types from the API
within your application code. In order to avoid unintended imports from
the implementation it is recommended to add the API as compile-time
dependency, while the implementation should be added as runtime dependency
only:
Example 74.2. Specifying the Seam Validation Module dependencies in pom.xml
...
<properties>
<seam.validation.version>x.y.z</weld.version>
</properties>
...
<dependencies>
...
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seam-validation-api</artifactId>
<version>${seam.validation.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seam-validation</artifactId>
<version>${seam.validation.version}</version>
<scope>runtime</scope>
</dependency>
...
</dependencies>
...
Replace "x.y.z" in the properties block with the Seam Validation version you want to use.
In case you are not working with Maven or a comparable build management tool you can also add Seam Validation manually to you project.
Just download the latest distribution file from SourceForge, un-zip it and add seam-validation.jar api as well as all JARs contained in the lib folder of the distribution to the classpath of your project.