Instead of managing all dependencies manually, maven users have the
possibility to use the JBoss maven repository.
Just add the JBoss repository url to the repositories
section of your pom.xml
or
settings.xml
:
Example 1.1. Adding the JBoss maven repository to
settings.xml
<repository> <id>repository.jboss.org</id> <name>JBoss Maven Repository</name> <url>http://repository.jboss.org/maven2</url> <layout>default</layout> </repository>
Then add the following dependencies to your pom.xml:
Example 1.2. Maven dependencies for Hibernate Search
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-search</artifactId> <version>3.1.1.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-annotations</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> </dependency> <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-common</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-core</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-snowball</artifactId> <version>2.4.1</version> </dependency>
Not all dependencies are required. Only the
hibernate-search dependency is mandatory. This
dependency, together with its required transitive dependencies, contain
all required classes needed to use Hibernate Search.
hibernate-annotations is only needed if you want to
use annotations to configure your domain model as we do in this tutorial.
However, even if you choose not to use Hibernate Annotations you still
have to use the Hibernate Search specific annotations, which are bundled
with the hibernate-search jar file, to configure your Lucene index.
Currently there is no XML configuration available for Hibernate Search.
hibernate-entitymanager is required if you want to
use Hibernate Search in conjunction with JPA. The Solr dependencies are
needed if you want to utilize Solr's analyzer framework. More about this
later. And finally, the lucene-snowball
dependency is
needed if you want to use Lucene's snowball stemmer.