It’s easy to get up and running with Infinispan. All you need is Java and a dependency management and build tool such as Maven.
1. Getting starting with Infinispan
1.1. Infinispan requirements
It’s easy to get started with Infinispan. All you need is Java, dependency management tooling, and either the Infinispan server or core libraries.
1.1.1. Software Requirements
To run Infinispan, you’ll need:
-
Java 11 JDK at a minimum.
-
Maven 3.2 or later. Infinispan also works with Gradle and Ivy.
1.1.2. JDK
Choose your Java runtime and follow their installation instructions. For example, you could choose:
1.1.3. Maven
Run mvn --version to check your current Maven version. If you have Maven 3.2
or later, you are ready to go.
If you need to install Maven, visit https://maven.apache.org/install.html.
1.1.4. Getting Infinispan
You can:
-
Download the Infinispan Server distribution. Visit the Download Infinispan page to get the latest stable release.
-
Pull the Infinispan image.
-
Add the
infinispan-coreartifact to yourpom.xmland use Infinispan directly in your project.
1.2. Generating projects from Maven archetypes
Infinispan provides a set of Maven archetypes that you can use to generate
skeleton projects with sample code and pom.xml files. You can then import
these projects into your IDE and start building and running applications with
Infinispan capabilities.
-
Maven 3.2 or later.
-
Configure Maven settings to include the
org.infinispan.archetypesartifacts.
-
Open a terminal window in the directory where you want to create project files.
-
Generate projects from Infinispan archetypes with the following command:
mvn archetype:generate -DarchetypeGroupId=org.infinispan.archetypes \ -DarchetypeArtifactId=<archetype-name> \ (1) -DarchetypeVersion=<infinispan-version> (2)
1 Creates projects from one of the following archetypes: -
clientCreates a sample Hot Rod Java client application. -
embeddedCreates a sample application that embeds Infinispan. -
storeCreates a sample implementation of a custom cache store. -
server-taskCreates a sample implementation of a ServerTask.
2 Specifies the Infinispan version to use, for example: -DarchetypeVersion=14.0.12.Final -
-
When prompted, define artifactId, groupId, and version values for your project.
-
Import your new Infinispan project into your IDE.
-
Run your project application from the directory where the
pom.xmlfile resides as follows:mvn package exec:java
The
storeandserver-taskarchetype does not include a project application,Application.java, that you can run.