Skip to content

Commit e696470

Browse files
committed
Use JDK 11 for core builds and quiet port scripts
1 parent 4f43c0d commit e696470

File tree

4 files changed

+33
-41
lines changed

4 files changed

+33
-41
lines changed

BUILDING.md

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

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

55
## Prerequisites
66

7-
- **JDK 8**
7+
- **JDK 11**
88
- **JDK 17** for building the Android port
99
- **Apache Maven 3.6+**
1010
- macOS with Xcode (required only for the iOS port)
1111

12-
The helper scripts in the `scripts/` directory download these dependencies when they are not already installed. On Apple Silicon
13-
macOS machines, the scripts download the Intel JDK 8 and run it via Rosetta because an ARM build of JDK 8 is unavailable.
12+
The helper scripts in the `scripts/` directory download these dependencies when they are not already installed.
1413

1514
### Installing JDKs on Linux
1615

1716
Download binaries from [Adoptium](https://adoptium.net):
1817

1918
```bash
20-
# JDK 8 (Linux x64; adjust `_x64_linux_` for your platform)
21-
curl -L -o temurin8.tar.gz https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u462b08.tar.gz
22-
tar xf temurin8.tar.gz
23-
export JAVA_HOME=$PWD/jdk8u462-b08
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
2423

2524
# JDK 17 (Linux x64; adjust `_x64_linux_` for your platform)
2625
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
@@ -32,7 +31,7 @@ export PATH="$JAVA_HOME/bin:$PATH"
3231

3332
## Preparing the workspace
3433

35-
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.
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.
3635

3736
```bash
3837
git clone https://github.com/codenameone/CodenameOne
@@ -45,8 +44,7 @@ The script runs `mvn install` in `maven/`, installs `cn1-maven-archetypes`, and
4544

4645
## Building the Android port
4746

48-
The Android port uses JDK 17 for compilation while Maven runs with JDK 8. Javadoc generation is skipped to avoid known Maven
49-
report issues. Run the build script:
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:
5048

5149
```bash
5250
./scripts/build-android-port.sh -DskipTests
@@ -66,9 +64,9 @@ Artifacts are produced in `maven/ios/target`.
6664

6765
## Convenience scripts
6866

69-
- `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`.
70-
- `build-android-port.sh` – builds the Android port using JDK 8 for Maven and JDK 17 for compilation.
71-
- `build-ios-port.sh` – builds the iOS port on macOS with JDK 8.
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.
7270

7371
## Further reading
7472

scripts/build-android-port.sh

Lines changed: 5 additions & 5 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 8 for Maven and JDK 17 for compilation
2+
# Build Codename One Android port using JDK 11 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 '1\.8'; then
14+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.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 '1\.8'; then
19-
echo "Failed to provision JDK 8" >&2
18+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
19+
echo "Failed to provision JDK 11" >&2
2020
exit 1
2121
fi
2222
if ! "${JAVA_HOME_17:-}/bin/java" -version 2>&1 | grep -q '17\.0'; then
@@ -40,4 +40,4 @@ if [ ! -f "$BUILD_CLIENT" ]; then
4040
fi
4141
fi
4242

43-
"$MAVEN_HOME/bin/mvn" -q -f maven/pom.xml -pl android -am -Dmaven.javadoc.skip=true clean install "$@"
43+
"$MAVEN_HOME/bin/mvn" -q -f maven/pom.xml -pl android -am -Dmaven.javadoc.skip=true -Djava.awt.headless=true clean install "$@"

scripts/build-ios-port.sh

Lines changed: 4 additions & 4 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 '1\.8'; then
20+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.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 '1\.8'; then
25-
echo "Failed to provision JDK 8" >&2
24+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '11\.0'; then
25+
echo "Failed to provision JDK 11" >&2
2626
exit 1
2727
fi
2828
export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH"
@@ -36,4 +36,4 @@ if [ ! -f "$BUILD_CLIENT" ]; then
3636
fi
3737
fi
3838

39-
"$MAVEN_HOME/bin/mvn" -q -f maven/pom.xml -pl ios -am clean install "$@"
39+
"$MAVEN_HOME/bin/mvn" -q -f maven/pom.xml -pl ios -am -Djava.awt.headless=true clean install "$@"

scripts/setup-workspace.sh

Lines changed: 12 additions & 18 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 8 and JDK 17,
3+
# Prepare Codename One workspace by installing Maven, provisioning JDK 11 and JDK 17,
44
# building core modules, and installing Maven archetypes.
55
###
66
set -euo pipefail
@@ -31,15 +31,9 @@ case "$arch_name" in
3131
*) echo "Unsupported architecture: $arch_name" >&2; exit 1 ;;
3232
esac
3333

34-
# JDK 8 is not available for Apple Silicon. Use the Intel build when running on macOS ARM.
35-
jdk8_arch="$arch"
36-
jdk17_arch="$arch"
37-
if [ "$os" = "mac" ] && [ "$arch" = "aarch64" ]; then
38-
jdk8_arch="x64"
39-
fi
40-
41-
JDK8_URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_${jdk8_arch}_${os}_hotspot_8u462b08.tar.gz"
42-
JDK17_URL="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_${jdk17_arch}_${os}_hotspot_17.0.16_8.tar.gz"
34+
# 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"
36+
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"
4337
MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz"
4438

4539
install_jdk() {
@@ -58,12 +52,12 @@ install_jdk() {
5852
eval "$dest_var=\"$home\""
5953
}
6054

61-
log "Ensuring JDK 8 is available"
62-
if [ ! -x "${JAVA_HOME:-}/bin/java" ] || ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8'; then
63-
log "Provisioning JDK 8 (this may take a while)..."
64-
install_jdk "$JDK8_URL" JAVA_HOME
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
6559
else
66-
log "Using existing JDK 8 at $JAVA_HOME"
60+
log "Using existing JDK 11 at $JAVA_HOME"
6761
fi
6862

6963
log "Ensuring JDK 17 is available"
@@ -96,14 +90,14 @@ ENV
9690

9791
source "$TOOLS/env.sh"
9892

99-
log "JDK 8 version:"; "$JAVA_HOME/bin/java" -version
93+
log "JDK 11 version:"; "$JAVA_HOME/bin/java" -version
10094
log "JDK 17 version:"; "$JAVA_HOME_17/bin/java" -version
10195
log "Maven version:"; "$MAVEN_HOME/bin/mvn" -version
10296

10397
PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH"
10498

10599
log "Building Codename One core modules"
106-
"$MAVEN_HOME/bin/mvn" -f maven/pom.xml -DskipTests install "$@"
100+
"$MAVEN_HOME/bin/mvn" -q -f maven/pom.xml -DskipTests -Djava.awt.headless=true install "$@"
107101

108102
BUILD_CLIENT="$HOME/.codenameone/CodeNameOneBuildClient.jar"
109103
log "Ensuring CodeNameOneBuildClient.jar is installed"
@@ -119,4 +113,4 @@ log "Installing cn1-maven-archetypes"
119113
if [ ! -d cn1-maven-archetypes ]; then
120114
git clone https://github.com/shannah/cn1-maven-archetypes
121115
fi
122-
(cd cn1-maven-archetypes && "$MAVEN_HOME/bin/mvn" -DskipTests -Dinvoker.skip=true install)
116+
(cd cn1-maven-archetypes && "$MAVEN_HOME/bin/mvn" -q -DskipTests -DskipITs=true -Dinvoker.skip=true install)

0 commit comments

Comments
 (0)