6 Running the Coherence Examples
Note:
In the rest of the document, examples refer to both guides and tutorials.This chapter includes the following sections:
- About Coherence Examples
There are two subsets of examples: Guides and Tutorials. - Obtaining the Examples
The examples are hosted on the Coherence Community Edition GitHub repository. - Prerequisites
Each example has documentation outlining the prerequisites for building and running the specific example. - Building and Running the Examples
The way to build and run the examples depends on whether you are running the examples against the Community Edition (CE) or the Coherence 14.1.1.2206 Feature Pack release.
About Coherence Examples
There are two subsets of examples: Guides and Tutorials.
Guides - These simple guides are designed to be a quick hands-on introduction to a specific feature of Coherence. In most cases, they require nothing more than a Coherence jar and an IDE (or a text editor if you are old-school). Guides are typically built as a combination of Maven and Gradle project, including the corresponding wrappers for those tools, making them simple to build as stand-alone projects without needing to build the whole Coherence source tree.
Tutorials - These tutorials provide a deeper understanding of larger Coherence features and concepts that cannot usually be explained with a few simple code snippets. They might, for example, require a running Coherence cluster to properly show a feature. Tutorials are typically built as a combination of Maven and Gradle project, including the corresponding wrappers for those tools, making them simple to build as stand-alone projects without needing to build the whole Coherence source tree.
Parent topic: Running the Coherence Examples
Obtaining the Examples
git clone https://github.com/oracle/coherence.git
This command clones the examples into a directory called coherence
,
off the current directory. You can find the examples in the
prj/examples
sub-directory.
The documentation for the examples is available online. See Examples - Guides & Tutorials Overview.
Parent topic: Running the Coherence Examples
Prerequisites
Parent topic: Running the Coherence Examples
Building and Running the Examples
The way to build and run the examples depends on whether you are running the examples against the Community Edition (CE) or the Coherence 14.1.1.2206 Feature Pack release.
- Running Example Using the Coherence Community Edition
- Running Examples Using Coherence 14.1.1.2206 Feature Pack
Parent topic: Running the Coherence Examples
Running Example Using the Coherence Community Edition
Parent topic: Building and Running the Examples
Running Examples Using Coherence 14.1.1.2206 Feature Pack
This section includes the following topics:
Parent topic: Building and Running the Examples
Installing the Prerequisites
After you have installed the Feature Pack, you must install the required Coherence Maven poms and jars to run the examples. This step is required only once.
Set the COHERENCE_HOME environment variable to the
coherence directory under your installation directory. For example, if
Coherence is installed in the /u01/coherenceHome
location,
then
COHERENCE_HOME=/u01/coherenceHome/coherence
.
Run the following commands to install the various artifacts which are the minimum requirements for most of the examples.
Note:
You can also use themaven-sync
plug-in to install all artifacts. See Introduction to the Maven Synchronization
Plug-In in Developing Applications Using Continuous Integration.
mvn install:install-file -Dpackaging=pom -Dfile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-bom/14.1.1/coherence-bom.14.1.1.pom \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-bom/14.1.1/coherence-bom.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence/14.1.1/coherence.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-bedrock.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-bedrock/14.1.1/coherence-bedrock.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-bedrock-testing-support.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-bedrock-testing-support/14.1.1/coherence-bedrock-testing-support.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-grpc.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-grpc/14.1.1/coherence-grpc.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-grpc-proxy.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-grpc-proxy/14.1.1/coherence-grpc-proxy.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-java-client.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-java-client/14.1.1/coherence-java-client.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-json.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-json/14.1.1/coherence-json.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-cdi-server.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-cdi-server/14.1.1/coherence-cdi-server.14.1.1.pom
mvn install:install-file -Dfile=$COHERENCE_HOME/lib/coherence-cdi.jar \
-DpomFile=$COHERENCE_HOME/plugins/maven/com/oracle/coherence/coherence-cdi/14.1.1/coherence-cdi.14.1.1.pom
mvn install:install-file -Dpackaging=pom -Dfile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-bom\14.1.1\coherence-bom.14.1.1.pom ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-bom\14.1.1\coherence-bom.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence\14.1.1\coherence.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-bedrock.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-bedrock\14.1.1\coherence-bedrock.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-bedrock-testing-support.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-bedrock-testing-support\14.1.1\coherence-bedrock-testing-support.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-grpc.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-grpc\14.1.1\coherence-grpc.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-grpc-proxy.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-grpc-proxy\14.1.1\coherence-grpc-proxy.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-java-client.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-java-client\14.1.1\coherence-java-client.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-json.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-json\14.1.1\coherence-json.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-cdi-server.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-cdi-server\14.1.1\coherence-cdi-server.14.1.1.pom
mvn install:install-file -Dfile=%COHERENCE_HOME%\lib\coherence-cdi.jar ^
-DpomFile=%COHERENCE_HOME%\plugins\maven\com\oracle\coherence\coherence-cdi\14.1.1\coherence-cdi.14.1.1.pom
Building and Running Any Example
To run any of the examples, you must change the group id and revision
using the -D
option in mvnw
or the -P
option in gradlew
commands to set the Coherence version and group ID
you are using.
Examples are shown below:
./mvnw -Dcoherence.group.id=com.oracle.coherence -Drevision=14.1.1-2206-1 clean verify
./gradlew -PcoherenceGroupId=com.oracle.coherence -PcoherenceVersion=14.1.1-2206-1 clean build