Infinispan uses Maven as a build tool. The following steps describe the sequence of tasks to build Infinispan from the source code:
You will need a copy of the Infinispan sources, which can be downloaded from Github, but it's important to note that the git version of Infinispan might contain unreleased and unstable changes, it's intended for developers and contributors.
To get the source from Github, first of all, you must have a git client to clone the repository. To clone the Infinispan from Github, you can execute the following command:
git clone https://github.com/infinispan/infinispan.git
If everything went well, you should see a new folder called
Infinispan
with the following folder structure:But first, since Infinispan is a very big multi-modular project, we will probably run into an
OutOfMemoryError
exception when building it. To prevent the error, we must instruct Maven to use more memory by setting theMAVEN_OPTS
environment variable to increase the memory of the JVM executing the following command:export MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=128m'
On Windows, use:
set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m
Now, we can finally build Infinispan using the following command:
mvn clean package install -DskipTests
This command will first clean out any old build and binary and then it will package the module as a JAR file, and insert them into the target folder.
The DskipTests
parameter will prevent the unit tests from being run and finally, the install command installs the artifacts in your local repo for use by other projects/modules, including inter-module dependencies within the same project.
The next step is to open the source code with your preferred IDE that provides basic support to Apache Maven such as Eclipse, IntelliJ IDEA, and Netbeans.
Here, we are going to present how to setup IntelliJ IDEA.
Assuming that you have downloaded and compiled the source code, let's import the Infinispan project to IntelliJ IDE. Perform the following steps:
If no project is currently open in your IntelliJ (I'm using IntelliJ IDEA 14.0.3), click on Import Project and change the directory to the location where you cloned Infinispan.
Automatically, IntelliJ will detect the
pom.xml
file in the infinispan root folder and import the Maven project. Select all the projects you want to import and press Next.At the end of the import process, IntelliJ will open all projects, as you can see in the following image:
Before starting to code, on IntelliJ, you will need to set up a specific feature introduced in Infinispan 5, which uses annotation processing as part of the compilation, to allow log messages to be internationalized. To change IntelliJ, open the Preferences window and go to Compiler | Annotation Processor and select the Enable annotation processing option. In the Annotation Processors option, add a new Processor FQ Name by pressing the plus button and insert
org.jboss.logging.LoggingToolsProcessor
.Infinispan also requires the IntelliJ Scala plugin to work. To install the plugin, open the Preferences window, go the Plugins option, and click in the Browse Repositories button. In the Browse Repositories pane, search for the Scala plugin and click on Install plugin.
You will need to restart the IDE for the plugin installation to take effect.