CI/CD java with Maven #180409
Replies: 5 comments 1 reply
-
|
Use the setup-java action with the 'zulu' or 'oracle' distribution to dynamically download JDK 25 during your GitHub Actions build. If that fails, run your workflow inside a Docker container (like eclipse-temurin:25-jdk-alpine) to guarantee the correct environment. Ensure your pom.xml compiler plugin configuration explicitly targets release 25 to match your JDK version. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @RafaelaHaskasa! following up on @dong11hyun's advice, since Java 25 is the latest feature release, it might not be the default on GitHub runners yet. You can force the installation in your workflow file. Here is a snippet you can copy into your name: Java CI with Maven
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin' # Temurin (Adoptium) usually supports the latest versions quickly
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml |
Beta Was this translation helpful? Give feedback.
-
|
Hi @RafaelaHaskasa You can still use JDK 25 on GitHub Actions even though it’s not preinstalled on the runners yet. Here’s the simplest working setup: name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '25'
cache: 'maven'Then just build as usual: name: Build with Maven
run: mvn -B package --file pom.xmlIf for some reason the runner can’t pull JDK 25, an easy fallback is to run the job inside a Docker image that already includes it: This way you can continue using IntelliJ + JDK 25 locally and still have your CI pipeline match your environment. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
Just to add one thing nobody mentioned — make sure your pom.xml actually tells Maven to compile against Java 25, otherwise you might set up JDK 25 in the workflow but Maven silently compiles to an older bytecode version. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Misc
Discussion Details
I have a group project that we are working on with intellij, JDK25, but as ive seen github doesnt support yet JDK25, can you give me some good options in order to fix this, i really want to work with Maven
Beta Was this translation helpful? Give feedback.
All reactions