Skip to content

Commit a35a972

Browse files
authored
Build against Java 21 (#2929)
* Update kamon and kanela-agent Previous version was not compatible with JDK21, see kamon-io/kanela#150. * Add and configure maven wrapper to use maven 3.9.9 This will make it easier to control which version of maven is used to build eclair, which in turns makes deterministic builds easier, as well as using recent compiler options (to target newer JDKs for example). For example, even recent versions of Github runner images use an old version of maven and there is no easy way to upgrade. * Update Dockerfile We now use multiarch (amd64/arm64) base images. * Run CI tests with JDK21 * Update doc to recommend Adoptium OpenJDK21 * Target Java 21 Eclair now targets Java 21 and will require a compatible Java Runtime Environment. It will no longer work on JRE 11 and JRE 17.
1 parent 27ba60f commit a35a972

File tree

20 files changed

+634
-136
lines changed

20 files changed

+634
-136
lines changed

.github/workflows/latest-bitcoind.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ jobs:
3838
with:
3939
path: eclair
4040

41-
- name: Set up JDK 11
41+
- name: Set up JDK 21
4242
uses: actions/setup-java@v3
4343
with:
44-
java-version: 11
44+
java-version: 21
4545
distribution: 'adopt'
4646

4747
- name: Configure OS settings
4848
run: echo "fs.file-max = 1024000" | sudo tee -a /etc/sysctl.conf
4949

5050
- name: Run eclair tests
51-
run: BITCOIND_DIR=$GITHUB_WORKSPACE/bitcoin/build/src mvn test
51+
run: BITCOIND_DIR=$GITHUB_WORKSPACE/bitcoin/build/src ./mvnw test
5252
working-directory: ./eclair

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
timeout-minutes: 30
1414

1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

18-
- name: Set up JDK 11
19-
uses: actions/setup-java@v3
18+
- name: Set up JDK 21
19+
uses: actions/setup-java@v4
2020
with:
21-
java-version: 11
21+
java-version: 21
2222
distribution: 'adopt'
2323

2424
- name: Cache Maven dependencies
@@ -34,7 +34,7 @@ jobs:
3434
# NB: we exclude external API tests from the CI, because we don't want our build to fail because a dependency is failing.
3535
# This means we won't automatically catch changes in external APIs, but developers should regularly run the test suite locally so in practice it shouldn't be a problem.
3636
- name: Build with Maven
37-
run: mvn test-compile && mvn scoverage:report -DtagsToExclude=external-api
37+
run: ./mvnw test-compile && ./mvnw scoverage:report -DtagsToExclude=external-api
3838

3939
- name: Upload coverage to Codecov
4040
uses: codecov/codecov-action@v3

.mvn/wrapper/maven-wrapper.jar

61.6 KB
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
20+
distributionSha256Sum=4ec3f26fb1a692473aea0235c300bd20f0f9fe741947c82c1234cefd76ac3a3c
21+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
22+
wrapperSha256Sum=3d8f20ce6103913be8b52aef6d994e0c54705fb527324ceb9b835b338739c7a8

BUILD.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## Requirements
44

5-
- [OpenJDK 11](https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot).
6-
- [Maven](https://maven.apache.org/download.cgi) 3.6.0 or newer
5+
- [OpenJDK 21](https://adoptium.net/temurin/releases/?package=jdk&version=21).
6+
- [Maven](https://maven.apache.org/download.cgi) 3.9.2 or newer
77

88
## Build
99

@@ -14,61 +14,61 @@ that we release, you must use the build environment (OS, JDK, maven...) that we
1414
To build the project and run the tests, simply run:
1515

1616
```shell
17-
mvn package
17+
./mvnw package
1818
```
1919

2020
Notes:
2121

2222
- This command will build all modules (core, node, gui).
23-
- If the build fails, you may need to clean previously built artifacts with the `mvn clean` command.
23+
- If the build fails, you may need to clean previously built artifacts with the `./mvnw clean` command.
2424
- Archives can be found in the `target` folder for each module.
2525

2626
### Skip tests
2727

2828
Running tests takes time. If you want to skip them, use `-DskipTests`:
2929

3030
```shell
31-
mvn package -DskipTests
31+
./mvnw package -DskipTests
3232
```
3333

3434
### Run tests
3535

3636
To only run the tests, run:
3737

3838
```shell
39-
mvn test
39+
./mvnw test
4040
```
4141

4242
To run tests for a specific class, run:
4343

4444
```shell
45-
mvn test -Dsuites=*<TestClassName>
45+
./mvnw test -Dsuites=*<TestClassName>
4646
```
4747

4848
To run tests using a specific number of threads, run:
4949

5050
```shell
51-
mvn -T <thread_count> test
51+
./mvnw -T <thread_count> test
5252
```
5353

5454
To run tests with a specific version of `bitcoind`, run:
5555

5656
```shell
57-
BITCOIND_DIR=<absolute/path/to/directory> mvn test
57+
BITCOIND_DIR=<absolute/path/to/directory> ./mvnw test
5858
```
5959

6060
### Build specific module
6161

6262
To only build the `eclair-node` module, run:
6363

6464
```shell
65-
mvn package -pl eclair-node -am -Dmaven.test.skip=true
65+
./mvnw package -pl eclair-node -am -Dmaven.test.skip=true
6666
```
6767

6868
To install `eclair-core` into your local maven repository and use it in another project, run:
6969

7070
```shell
71-
mvn clean install -pl eclair-core -am -Dmaven.test.skip=true
71+
./mvnw clean install -pl eclair-core -am -Dmaven.test.skip=true
7272
```
7373

7474
## Build the API documentation

Dockerfile

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,33 @@
1-
FROM adoptopenjdk/openjdk11:jdk-11.0.3_7-alpine as BUILD
2-
3-
# Setup maven, we don't use https://hub.docker.com/_/maven/ as it declare .m2 as volume, we loose all mvn cache
4-
# We can alternatively do as proposed by https://github.com/carlossg/docker-maven#packaging-a-local-repository-with-the-image
5-
# this was meant to make the image smaller, but we use multi-stage build so we don't care
6-
RUN apk add --no-cache curl tar bash
7-
8-
ARG MAVEN_VERSION=3.9.2
9-
ARG USER_HOME_DIR="/root"
10-
ARG SHA=900bdeeeae550d2d2b3920fe0e00e41b0069f32c019d566465015bdd1b3866395cbe016e22d95d25d51d3a5e614af2c83ec9b282d73309f644859bbad08b63db
11-
ARG BASE_URL=https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries
12-
13-
RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
14-
&& curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
15-
&& echo "${SHA} /tmp/apache-maven.tar.gz" | sha512sum -c - \
16-
&& tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
17-
&& rm -f /tmp/apache-maven.tar.gz \
18-
&& ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
19-
20-
ENV MAVEN_HOME /usr/share/maven
21-
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
1+
FROM eclipse-temurin:21-jdk-alpine as BUILD
222

233
# Let's fetch eclair dependencies, so that Docker can cache them
244
# This way we won't have to fetch dependencies again if only the source code changes
255
# The easiest way to reliably get dependencies is to build the project with no sources
266
WORKDIR /usr/src
7+
COPY mvnw mvnw
8+
COPY .mvn .mvn
279
COPY pom.xml pom.xml
2810
COPY eclair-core/pom.xml eclair-core/pom.xml
2911
COPY eclair-front/pom.xml eclair-front/pom.xml
3012
COPY eclair-node/pom.xml eclair-node/pom.xml
3113
COPY eclair-node/modules/assembly.xml eclair-node/modules/assembly.xml
3214
RUN mkdir -p eclair-core/src/main/scala && touch eclair-core/src/main/scala/empty.scala
3315
# Blank build. We only care about eclair-node, and we use install because eclair-node depends on eclair-core
34-
RUN mvn install -pl eclair-node -am
35-
RUN mvn clean
16+
RUN ./mvnw install -pl eclair-node -am
17+
RUN ./mvnw clean
3618

3719
# Only then do we copy the sources
3820
COPY . .
3921

4022
# And this time we can build in offline mode, specifying 'notag' instead of git commit
41-
RUN mvn package -pl eclair-node -am -DskipTests -Dgit.commit.id=notag -Dgit.commit.id.abbrev=notag -o
23+
RUN ./mvnw package -pl eclair-node -am -DskipTests -Dgit.commit.id=notag -Dgit.commit.id.abbrev=notag -o
4224
# It might be good idea to run the tests here, so that the docker build fail if the code is bugged
4325

44-
# We currently use a debian image for runtime because of some jni-related issue with sqlite
45-
FROM openjdk:11.0.4-jre-slim
26+
FROM eclipse-temurin:21-jre-alpine
4627
WORKDIR /app
4728

4829
# install jq for eclair-cli
49-
RUN apt-get update && apt-get install -y bash jq curl unzip
30+
RUN apk add bash jq curl unzip
5031

5132
# copy and install eclair-cli executable
5233
COPY --from=BUILD /usr/src/eclair-core/eclair-cli .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ rpcclienttimeout=30
9494

9595
Eclair is developed in [Scala](https://www.scala-lang.org/), a powerful functional language that runs on the JVM, and is packaged as a ZIP archive.
9696

97-
To run Eclair, you first need to install Java, we recommend that you use [OpenJDK 11](https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot). Other runtimes also work, but we don't recommend using them.
97+
To run Eclair, you first need to install Java. Eclair targets Java 21 and will run on any compatible Java runtime, we recommend that you use [OpenJDK 21](https://adoptium.net/temurin/releases/?package=jdk&version=21).
9898

9999
Then download our latest [release](https://github.com/ACINQ/eclair/releases), unzip the archive and run the following command:
100100

contrib/arm64v8.Dockerfile

Lines changed: 0 additions & 65 deletions
This file was deleted.

docs/Cluster.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ $ git clone [email protected]:ACINQ/eclair.git
146146
$ vi eclair-core/src/main/reference.conf # set akka.remote.artery.transport = "tls-tcp"
147147
$ cp akka-cluster-tls.jks eclair-front/modules/awseb/ # copy the file you generated
148148
$ vi eclair-front/modules/awseb.xml # uncomment the relevant parts
149-
$ mvn package -DskipTests
149+
$ ./mvnw package -DskipTests
150150
```
151151
Alternatively, you can also edit the existing bundle and manually add the `akka-cluster-tls.jks` file to the root of the zip archive. You will also need to set `akka.remote.artery.transport=tls-tcp` at runtime.
152152

docs/release-notes/eclair-vnext.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ When `option_provide_storage` is enabled, eclair will store a small encrypted ba
1313
This backup is limited to 65kB and node operators should customize the `eclair.peer-storage` configuration section to match their desired SLAs.
1414
This is mostly intended for LSPs that serve mobile wallets to allow users to restore their channels when they switch phones.
1515

16+
### Eclair requires a Java 21 runtime
17+
18+
Eclair now targets Java 21 and requires a compatible Java Runtime Environment. It will no longer work on JRE 11 or JRE 17.
19+
There are many organisations that package Java runtimes and development kits, for example [OpenJDK 21](https://adoptium.net/temurin/releases/?package=jdk&version=21).
20+
1621
### API changes
1722

1823
<insert changes>
@@ -45,14 +50,14 @@ $ sha256sum -c SHA256SUMS.stripped
4550

4651
Eclair builds are deterministic. To reproduce our builds, please use the following environment (*):
4752

48-
- Ubuntu 22.04
49-
- AdoptOpenJDK 11.0.22
53+
- Ubuntu 24.04.1
54+
- Adoptium OpenJDK 21.0.4
5055
- Maven 3.9.2
5156

5257
Use the following command to generate the eclair-node package:
5358

5459
```sh
55-
mvn clean install -DskipTests
60+
./mvnw clean install -DskipTests
5661
```
5762

5863
That should generate `eclair-node/target/eclair-node-<version>-XXXXXXX-bin.zip` with sha256 checksums that match the one we provide and sign in `SHA256SUMS.asc`

0 commit comments

Comments
 (0)