Skip to content

Commit 2d4242d

Browse files
committed
Use JDK 8 for core builds
1 parent e696470 commit 2d4242d

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

BUILDING.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Building Codename One
22

3-
This guide explains how to build Codename One from source with Maven. It covers the core framework and the Android and iOS ports.
3+
This guide explains how to build Codename One from source using Maven. It provides reproducible steps to compile the core framework and its Android and iOS ports.
44

55
## Prerequisites
66

7-
- **JDK 11**
7+
- **JDK 8**
88
- **JDK 17** for building the Android port
99
- **Apache Maven 3.6+**
1010
- macOS with Xcode (required only for the iOS port)
@@ -16,10 +16,10 @@ The helper scripts in the `scripts/` directory download these dependencies when
1616
Download binaries from [Adoptium](https://adoptium.net):
1717

1818
```bash
19-
# JDK 11 (Linux x64; adjust `_x64_linux_` for your platform)
20-
curl -L -o temurin11.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.28%2B6/OpenJDK11U-jdk_x64_linux_hotspot_11.0.28_6.tar.gz
21-
tar xf temurin11.tar.gz
22-
export JAVA_HOME=$PWD/jdk-11.0.28+6
19+
# JDK 8 (Linux x64; adjust `_x64_linux_` for your platform)
20+
curl -L -o temurin8.tar.gz https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u462b08.tar.gz
21+
tar xf temurin8.tar.gz
22+
export JAVA_HOME=$PWD/jdk8u462-b08
2323

2424
# JDK 17 (Linux x64; adjust `_x64_linux_` for your platform)
2525
curl -L -o temurin17.tar.gz https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.16_8.tar.gz
@@ -31,7 +31,7 @@ export PATH="$JAVA_HOME/bin:$PATH"
3131

3232
## Preparing the workspace
3333

34-
Clone the repository and run the setup script to download JDK 11 and JDK 17, install Maven, build the core modules, and install the Maven archetypes. This step must be performed before building any ports.
34+
Clone the repository and run the setup script to download JDK 8 and JDK 17, install Maven, build the core modules, and install the Maven archetypes. This step must be performed before building any ports.
3535

3636
```bash
3737
git clone https://github.com/codenameone/CodenameOne
@@ -44,7 +44,7 @@ The script runs `mvn install` in `maven/`, installs `cn1-maven-archetypes`, and
4444

4545
## Building the Android port
4646

47-
The Android port uses JDK 17 for compilation while Maven runs with JDK 11. Javadoc generation is skipped to avoid known Maven report issues. Run the build script:
47+
The Android port uses JDK 17 for compilation while Maven runs with JDK 8. Javadoc generation is skipped to avoid known Maven report issues. Run the build script:
4848

4949
```bash
5050
./scripts/build-android-port.sh -DskipTests
@@ -64,9 +64,9 @@ Artifacts are produced in `maven/ios/target`.
6464

6565
## Convenience scripts
6666

67-
- `setup-workspace.sh` – installs Maven, downloads JDK 11 and JDK 17, builds the core modules, installs Maven archetypes, provisions the Codename One build client, and writes `tools/env.sh`.
68-
- `build-android-port.sh` – builds the Android port using JDK 11 for Maven and JDK 17 for compilation.
69-
- `build-ios-port.sh` – builds the iOS port on macOS with JDK 11.
67+
- `setup-workspace.sh` – installs Maven, downloads JDK 8 and JDK 17, builds the core modules, installs Maven archetypes, provisions the Codename One build client, and writes `tools/env.sh`.
68+
- `build-android-port.sh` – builds the Android port using JDK 8 for Maven and JDK 17 for compilation.
69+
- `build-ios-port.sh` – builds the iOS port on macOS with JDK 8.
7070

7171
## Further reading
7272

scripts/build-android-port.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Build Codename One Android port using JDK 11 for Maven and JDK 17 for compilation
2+
# Build Codename One Android port using JDK 8 for Maven and JDK 17 for compilation
33
set -euo pipefail
44
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
55
cd "$ROOT"
@@ -11,12 +11,12 @@ else
1111
source "$ROOT/tools/env.sh"
1212
fi
1313

14-
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
14+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8\.0'; then
1515
./scripts/setup-workspace.sh -q -DskipTests
1616
source "$ROOT/tools/env.sh"
1717
fi
18-
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
19-
echo "Failed to provision JDK 11" >&2
18+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8\.0'; then
19+
echo "Failed to provision JDK 8" >&2
2020
exit 1
2121
fi
2222
if ! "${JAVA_HOME_17:-}/bin/java" -version 2>&1 | grep -q '17\.0'; then

scripts/build-ios-port.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ else
1717
./scripts/setup-workspace.sh -q -DskipTests
1818
source "$ROOT/tools/env.sh"
1919
fi
20-
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
20+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8\.0'; then
2121
./scripts/setup-workspace.sh -q -DskipTests
2222
source "$ROOT/tools/env.sh"
2323
fi
24-
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
25-
echo "Failed to provision JDK 11" >&2
24+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8\.0'; then
25+
echo "Failed to provision JDK 8" >&2
2626
exit 1
2727
fi
2828
export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH"

scripts/setup-workspace.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
###
3-
# Prepare Codename One workspace by installing Maven, provisioning JDK 11 and JDK 17,
3+
# Prepare Codename One workspace by installing Maven, provisioning JDK 8 and JDK 17,
44
# building core modules, and installing Maven archetypes.
55
###
66
set -euo pipefail
@@ -32,7 +32,11 @@ case "$arch_name" in
3232
esac
3333

3434
# Determine platform-specific JDK download URLs
35-
JDK11_URL="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.28%2B6/OpenJDK11U-jdk_${arch}_${os}_hotspot_11.0.28_6.tar.gz"
35+
arch_jdk8="$arch"
36+
if [ "$os" = "mac" ] && [ "$arch" = "aarch64" ]; then
37+
arch_jdk8="x64"
38+
fi
39+
JDK8_URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_${arch_jdk8}_${os}_hotspot_8u462b08.tar.gz"
3640
JDK17_URL="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_${arch}_${os}_hotspot_17.0.16_8.tar.gz"
3741
MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz"
3842

@@ -52,12 +56,12 @@ install_jdk() {
5256
eval "$dest_var=\"$home\""
5357
}
5458

55-
log "Ensuring JDK 11 is available"
56-
if [ ! -x "${JAVA_HOME:-}/bin/java" ] || ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
57-
log "Provisioning JDK 11 (this may take a while)..."
58-
install_jdk "$JDK11_URL" JAVA_HOME
59+
log "Ensuring JDK 8 is available"
60+
if [ ! -x "${JAVA_HOME:-}/bin/java" ] || ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8\.0'; then
61+
log "Provisioning JDK 8 (this may take a while)..."
62+
install_jdk "$JDK8_URL" JAVA_HOME
5963
else
60-
log "Using existing JDK 11 at $JAVA_HOME"
64+
log "Using existing JDK 8 at $JAVA_HOME"
6165
fi
6266

6367
log "Ensuring JDK 17 is available"
@@ -90,7 +94,7 @@ ENV
9094

9195
source "$TOOLS/env.sh"
9296

93-
log "JDK 11 version:"; "$JAVA_HOME/bin/java" -version
97+
log "JDK 8 version:"; "$JAVA_HOME/bin/java" -version
9498
log "JDK 17 version:"; "$JAVA_HOME_17/bin/java" -version
9599
log "Maven version:"; "$MAVEN_HOME/bin/mvn" -version
96100

0 commit comments

Comments
 (0)