Skip to content

Commit d8c843f

Browse files
committed
Updated configurable infinispan-client-setup.sh
1 parent 7838459 commit d8c843f

File tree

1 file changed

+60
-10
lines changed

1 file changed

+60
-10
lines changed

ga/latest/kernel/helpers/build/infinispan-client-setup.sh

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616

1717
set -Eeo pipefail
1818

19+
# Recommended stable baseline for Jakarta EE 10 / JDK 17+ environments.
20+
INFINISPAN_DEFAULT_VERSION="15.2.6.Final"
21+
INFINISPAN_CLIENT_VERSION=${INFINISPAN_CLIENT_VERSION:-$INFINISPAN_DEFAULT_VERSION}
22+
23+
# Resolves the latest patch release (x.y.Z) within the specified major.minor version.
24+
INFINISPAN_USE_LATEST_PATCH=${INFINISPAN_USE_LATEST_PATCH:-false}
25+
# Required for Infinispan 11+ on Liberty. Hard dependency for Liberty sessionCache-1.0.
26+
INFINISPAN_ENABLE_REACTIVE_STREAMS=${INFINISPAN_ENABLE_REACTIVE_STREAMS:-true}
27+
1928
pkgcmd=yum
2029
if ! command $pkgcmd
2130
then
@@ -24,17 +33,58 @@ fi
2433

2534
$pkgcmd update -y
2635
$pkgcmd install -y maven
27-
mkdir -p /opt/ibm/wlp/usr/shared/resources/infinispan
28-
echo '<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>io.openliberty</groupId> <artifactId>openliberty-infinispan-client</artifactId> <version>1.0</version> <!-- https://mvnrepository.com/artifact/org.infinispan/infinispan-jcache-remote --> <dependencies> <dependency> <groupId>org.infinispan</groupId> <artifactId>infinispan-jcache-remote</artifactId> <version>10.1.3.Final</version> </dependency> </dependencies></project>' > /opt/ibm/wlp/usr/shared/resources/infinispan/pom.xml
29-
mvn -f /opt/ibm/wlp/usr/shared/resources/infinispan/pom.xml versions:use-latest-releases -DallowMajorUpdates=false
30-
mvn -f /opt/ibm/wlp/usr/shared/resources/infinispan/pom.xml dependency:copy-dependencies -DoutputDirectory=/opt/ibm/wlp/usr/shared/resources/infinispan
36+
37+
CLIENT_JARS_DIR="/opt/ibm/wlp/usr/shared/resources/infinispan"
38+
mkdir -p "${CLIENT_JARS_DIR}"
39+
40+
cat << EOF > /opt/ibm/wlp/usr/shared/resources/infinispan/pom.xml
41+
<project xmlns="http://maven.apache.org/POM/4.0.0"
42+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
43+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44+
<modelVersion>4.0.0</modelVersion>
45+
<groupId>io.openliberty</groupId>
46+
<artifactId>openliberty-infinispan-client</artifactId>
47+
<version>1.0</version>
48+
49+
<!-- https://mvnrepository.com/artifact/org.infinispan/infinispan-jcache-remote -->
50+
<dependencies>
51+
<dependency>
52+
<groupId>org.infinispan</groupId>
53+
<artifactId>infinispan-jcache-remote</artifactId>
54+
<version>${INFINISPAN_CLIENT_VERSION}</version>
55+
</dependency>
56+
</dependencies>
57+
</project>
58+
EOF
59+
60+
if [ "${INFINISPAN_USE_LATEST_PATCH}" = "true" ]; then
61+
echo "Resolving latest Infinispan client patch release (no major upgrades)..."
62+
mvn -f "${CLIENT_JARS_DIR}/pom.xml" versions:use-latest-releases -DallowMajorUpdates=false
63+
fi
64+
65+
mvn -f /opt/ibm/wlp/usr/shared/resources/infinispan/pom.xml dependency:copy-dependencies -DoutputDirectory="${CLIENT_JARS_DIR}"
3166
# This fails with dependency errors using microdnf on ubi-minimal, but it is okay to let it fail
3267
yum remove -y maven || true
33-
rm -f /opt/ibm/wlp/usr/shared/resources/infinispan/pom.xml
34-
rm -f /opt/ibm/wlp/usr/shared/resources/infinispan/jboss-transaction-api*.jar
35-
rm -f /opt/ibm/wlp/usr/shared/resources/infinispan/reactive-streams-*.jar
36-
rm -f /opt/ibm/wlp/usr/shared/resources/infinispan/rxjava-*.jar
68+
rm -f "${CLIENT_JARS_DIR}/pom.xml"
69+
70+
# Remove unnecessary spec jars
71+
rm -f "${CLIENT_JARS_DIR}"/jboss-transaction-api*.jar
72+
rm -f "${CLIENT_JARS_DIR}"/jakarta.transaction-api*.jar
73+
74+
# Reactive streams are required for Infinispan 11+ on Liberty sessionCache-1.0
75+
# Only remove if explicitly disabled (default: enabled)
76+
if [ "${INFINISPAN_ENABLE_REACTIVE_STREAMS}" != "true" ]; then
77+
echo "Removing reactive-streams and rxjava jars as INFINISPAN_ENABLE_REACTIVE_STREAMS is not set to true..."
78+
rm -f "${CLIENT_JARS_DIR}"/reactive-streams-*.jar
79+
rm -f "${CLIENT_JARS_DIR}"/rxjava-*.jar
80+
fi
81+
3782
rm -rf ~/.m2
38-
chown -R 1001:0 /opt/ibm/wlp/usr/shared/resources/infinispan
39-
chmod -R g+rw /opt/ibm/wlp/usr/shared/resources/infinispan
83+
chown -R 1001:0 "${CLIENT_JARS_DIR}"
84+
chmod -R g+rw "${CLIENT_JARS_DIR}"
85+
86+
INSTALLED_VERSION=$(find "${CLIENT_JARS_DIR}/" -name "*infinispan-commons*.jar" -printf "%f" | sed 's/infinispan-commons-\(.*\).jar/\1/')
4087

88+
if [ -n "$INSTALLED_VERSION" ]; then
89+
echo "Successfully installed Infinispan client version: ${INSTALLED_VERSION}"
90+
fi

0 commit comments

Comments
 (0)