Chapter 9. Run Red Hat JBoss Data Grid in Library Mode

9.1. Run Red Hat JBoss Data Grid in Library Mode

This part includes information about using Red Hat JBoss Data Grid in Library Mode.

9.2. Create a New Red Hat JBoss Data Grid Project

This chapter is a guide to creating a new Red Hat JBoss Data Grid project. The tasks prescribed are a prerequisite for the quickstart tasks provided in Run Red Hat JBoss Data Grid in Library Mode (Single-Node Setup) and Run Red Hat JBoss Data Grid in Library Mode (Multi-Node Setup)

9.3. Add Dependencies to Your Project

Set up Red Hat JBoss Data Grid by adding dependencies to your project. If you are using Maven or other build systems that support Maven dependencies, add the following to your pom.xml file, located in the Maven repository folder:

<dependency>
          <groupId>org.infinispan</groupId>
          <artifactId>infinispan-embedded</artifactId>
          <version>$VERSION</version>
</dependency>
Note

Replace the version value with the appropriate version of the libraries included in JBoss Data Grid.

9.4. Add a Profile to Your Project

To enable the JBoss Maven repository for your project, add a profile to your settings.xml file in $HOME/.m2/settings.xml as follows:

Adding a Profile

<profiles>

    <!-- Configure the JBoss GA Maven repository -->
    <profile>
      <id>jboss-ga-repository</id>
      <repositories>
        <repository>
          <id>jboss-ga-repository</id>
          <url>http://maven.repository.redhat.com/ga/all</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>jboss-ga-plugin-repository</id>
          <url>http://maven.repository.redhat.com/ga/all</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
    <!-- Configure the JBoss Early Access Maven repository -->
    <profile>
      <id>jboss-earlyaccess-repository</id>
      <repositories>
        <repository>
          <id>jboss-earlyaccess-repository</id>
          <url>http://maven.repository.redhat.com/earlyaccess/all/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>jboss-earlyaccess-plugin-repository</id>
          <url>http://maven.repository.redhat.com/earlyaccess/all/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  </profiles>

<!-- Add active profiles information here -->

Enable the profile by ensuring the following is included in the settings.xml file:

Enable the Profile

  <activeProfiles>
    <!-- Optionally, make the repositories active by default -->
    <activeProfile>jboss-ga-repository</activeProfile>
    <activeProfile>jboss-earlyaccess-repository</activeProfile>
  </activeProfiles>

If you are using a build system that does not support declarative dependency management, ensure all used libraries, such as infinispan-embedded, are found on the build classpath.