Java 21 Support

I am trying to deploy my Spring Boot Java 21 project but i am getting error that Java 21 is not supported. I can see that Java 21 updated and merged into Main Project Railway Id = 0f4858db-976c-4f1a-91ea-0ba1b5fc740 This is from my Railway log #10 37.95 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project cep-system: Fatal error compiling: error: release version 21 not supported -> [Help 1]
23 Replies
Percy
Percy6mo ago
Project ID: N/A
Mafiaboss
Mafiaboss6mo ago
0f4858db-976c-4f1a-91ea-0ba1b5fc740
Brody
Brody6mo ago
for a build with java 31 you would need to write yourself a custom dockerfile to deploy your app
Mafiaboss
Mafiaboss6mo ago
Can you please send me documentation with some examples? Also for Using Graavlm Native Image. Do i just need to have plugin pom.xml or aswell something extra for Railway to use it?
Brody
Brody6mo ago
I don't have any docs on hand for that, though writing dockerfiles has no relation to railway so I'm sure you could find some examples. all you need to is have a Dockerfile in your repo and railway will use it if you are writing your own dockerfile then that is up to you
Mafiaboss
Mafiaboss6mo ago
Okay thank you very much for follow up!
Mafiaboss
Mafiaboss6mo ago
If you dont support Java 21, what does this PR do? https://github.com/railwayapp/nixpacks/pull/1020
GitHub
Add support for Java 20/21 in Java & Scala Providers by marcosperei...
What? This PR adds Java 20 and 21 support in Java and Scala providers. Specifically for Scala, it also updates the Eclipse Temurin images to the latest versions. Tests are added/updated if needed...
Brody
Brody6mo ago
supports java 20/21?
Ted M. Young
Ted M. Young6mo ago
So are the Nixpacks docs wrong here or is it Railway doesn't yet use the available Nixpacks? Railway docs link to this page: https://nixpacks.com/docs/providers/java that explicitly says JDK 21 is supported.
Mafiaboss
Mafiaboss6mo ago
EDIT: Java 31 was miss spell. I meant 21
Brody
Brody6mo ago
The version can be overridden by setting the NIXPACKS_JDK_VERSION environment variable.
Ted M. Young
Ted M. Young6mo ago
That doesn't work on my Maven Java 21 project 5c9217a3-e7e4-47db-97fa-19d27bec5d65
[Region: us-west1]
==============
Using Nixpacks
==============

context: 2556a1571a7cabe6a98664674a419fd0
Nixpacks build failed

Error: Unsupported JDK version: 21
[Region: us-west1]
==============
Using Nixpacks
==============

context: 2556a1571a7cabe6a98664674a419fd0
Nixpacks build failed

Error: Unsupported JDK version: 21
Ted M. Young
Ted M. Young6mo ago
No description
Brody
Brody6mo ago
you may need a dockerfile then
Ted M. Young
Ted M. Young6mo ago
So then the Railway Nixpack docs are incorrect? And Railway does not support JDK 21?
Brody
Brody6mo ago
I'm not sure, sorry
Ted M. Young
Ted M. Young6mo ago
Is there someone who might know better? It seems clear this is supposed to work given the merged PR #1020 from above. I understand this is a holiday weekend, so I'm fine with waiting until next week for more details.
Brody
Brody6mo ago
@aleks would know
root
root6mo ago
It looks like you're using Maven, is that correct? Ah, it looks like the Java 20 & 21 support hasn't made it into a release yet, I'm afraid you'll have to wait for a new version and use a dockerfile in the meantime
Brody
Brody6mo ago
thank you!!
root
root6mo ago
I'm afraid I'm really not that familiar with Maven, but you could probably modify https://github.com/aleksrutins/springboot-java/blob/master/Dockerfile (uses gradle) to fit your needs
GitHub
springboot-java/Dockerfile at master · aleksrutins/springboot-java
Contribute to aleksrutins/springboot-java development by creating an account on GitHub.
thomas
thomas6mo ago
What do you mean by that? What release doesn't include these versions? A nixpacks release?
root
root6mo ago
Correct