Problems with deploying a spring boot application
marcelmilka
HOBBYOP

6 months ago

Hey there! As described above I encountered problems while deploying my spring boot application via GitHub.

The error from build logs:

Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':compileKotlin'. > Cannot find a Java installation on your machine (Linux 6.1.0-37-cloud-amd64 amd64) matching: {languageVersion=17, vendor=any vendor, implementation=vendor-specific, nativeImageCapable=false}. Toolchain download repositories have not been configured.

current build.gradle.kts file:

plugins {

kotlin("jvm") version "1.9.25"

kotlin("plugin.spring") version "1.9.25"

kotlin("plugin.jpa") version "2.0.21"

id("org.springframework.boot") version "3.5.7"

id("io.spring.dependency-management") version "1.1.7"

}

group = "eu.project"

version = "0.0.1-SNAPSHOT"

description = "Demo project for Spring Boot"

java {

toolchain {

languageVersion.set(JavaLanguageVersion.of(17))

}

}

repositories {

mavenCentral()

}

dependencies {...}

kotlin {

compilerOptions {

freeCompilerArgs.addAll("-Xjsr305=strict")

}

}

tasks.withType {

useJUnitPlatform()

}

tasks.withType {

options.release.set(17)

}

Solved$10 Bounty

2 Replies

6 months ago

Are you using a Dockerfile? Railway has some guides on how to deploy a Spring Boot application

See here: https://docs.railway.com/guides/spring-boot


brent
HOBBY

3 months ago

Had the same issue. It's because of Railpack not being able to see which java version you're using and it defaults to java 21.

I added a railpack.json file to the root of my project with this configuration where I tell Railpack to use java 17 instead of defaulting to java 21.

{ "$schema": "https://schema.railpack.com", "packages": { "java": "17" }, "deploy": { "startCommand": "java $JAVA_OPTS -Dserver.port=$PORT -jar $(ls -1 build/libs/*.jar | grep -v plain | head -n 1)" } }


Status changed to Solved medim about 1 month ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...