3.4. Configure the Maven Repository

To configure the installed Red Hat JBoss Data Grid Maven repository, edit the settings.xml file. This file may be configured in one of two locations:
  1. User level - Maven user settings are located in the ${user.home}/.m2/ directory:
    • For Linux or Mac environments this is typically ~/.m2/
    • For Windows environments this is typically \Documents and Settings\.m2\ or \Users\.m2\
  2. Global level - Settings for all users on a machine, assuming they are all using the same Maven installation, is typically provided in ${maven.home}/conf/settings.xml
See Section B.2, “Maven Repository Configuration Example” to view sample Maven configurations, and refer to the Maven Documentation for more information about configuring Maven.

3.4.1. Configuring the JBoss Data Grid Maven Repository in an Offline Environment

In certain environments it is preferred to have the Maven repository available offline. To accomplish this configuration perform the following steps:
Prerequisites:

  • The JBoss Data Grid Maven repository has been downloaded to the internal network where it will be referenced.
  • An internal repository, such as Sonatype Nexus or Apache Archiva, is available on the network that contains Maven dependencies.

Procedure 3.2. Configure the JBoss Data Grid Maven Repository for Offline Usage

  1. Install the downloaded JBoss Data Grid Maven repository locally, following the instructions in Section 3.3.1, “Local File System Repository Installation”.
  2. Update the settings.xml to point to the locally extracted repository, as seen in Section 3.4, “Configure the Maven Repository”. A sample configuration is shown below:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    
       <profiles>
          <profile>
             <id>jboss-datagrid-repository</id>
             <repositories>
                <repository>
                   <id>jboss-datagrid-repository</id>
                   <name>JBoss Data Grid Maven Repository</name>
                   <url>file:///path/to/jboss-datagrid-7.0.0.GA-maven-repository/maven-repository</url>
                   <layout>default</layout>
                   <releases>
                      <enabled>true</enabled>
                      <updatePolicy>never</updatePolicy>
                   </releases>
                   <snapshots>
                      <enabled>false</enabled>
                      <updatePolicy>never</updatePolicy>
                   </snapshots>
                </repository>
             <pluginRepositories>
                <pluginRepository>
                   <id>jboss-datagrid-repository</id>
                   <name>JBoss Data Grid Maven Repository</name>
                   <url>file:///path/to/jboss-datagrid-7.0.0.GA-maven-repository/maven-repository</url>
                   <layout>default</layout>
                   <releases>
                      <enabled>true</enabled>
                      <updatePolicy>never</updatePolicy>
                   </releases>
                   <snapshots>
                      <enabled>false</enabled>
                      <updatePolicy>never</updatePolicy>
                   </snapshots>
                </pluginRepository>
             </pluginRepositories>
          </profile>
       </profiles>
       <activeProfiles>
          <!-- make the profile active by default -->
          <activeProfile>jboss-datagrid-repository</activeProfile>
       </activeProfiles>
    
    </settings>
  3. Ensure that projects may now be built locally.

3.4.2. Next Steps

After the newest available version of Red Hat JBoss Data Grid is installed and Maven is set up and configured, see Section 9.1, “Create a New Red Hat JBoss Data Grid Project” to learn how to use JBoss Data Grid for the first time.