Alain Duguine
Alain Duguine

Reputation: 475

Heroku install bad jdk (8) version in logs but good one (11) in terminal, which results in invalid target release: 11

I know this question was treated a lot of time, but i followed each and every one of the answers i could find, i checked everything i could think about but Heroku send me mixed signals.

I have a maven multi-module app with spring-boot,

i have a system.properties file with

java.runtime.version=11

My whole project is under java 11, i have in my parent pom.xml :

<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>

I even have added the right mvn command in the Procfile, which is normally not necessary

mvnw spring-boot:run -f ./cycle-api/cycle-api-webservice/pom.xml

my java and javac -version are 11

and when i do :

git push heroku feature/heroku:master

i have the right output in the terminal :

remote: Building source:
remote:
remote: -----> Java app detected
remote: -----> Installing JDK 11... done
remote: -----> Executing Maven

but when i go to my heroku repository, and click on "open app", i have an error, and if i go to the logs i have the classical

[ERROR] ... Fatal error compiling: invalid target release: 11 -> [Help 1]

and if i go to the very top of the log i have

-----> Java app detected
-----> Installing JDK 1.8... done
-----> Executing Maven

How is it possible that it shows me two different version of JDK on the same build ?

I even cloned the heroku git repository to check if everything is properly pushed, and yes it is. So i have absolutely no idea about what could cause this strange behaviour, so any help would be highly appreciated ! Thanks !

Upvotes: 0

Views: 110

Answers (1)

Alain Duguine
Alain Duguine

Reputation: 475

I finally manage to deploy it. So there was a problem with the git repo i think the remote was badly set. So i created a new heroku repo and i re-deployed from scratch. Then the Procfile doesn't allow the mvn command anymore apparently, so after that i had a mvn command not found error in the build. So finally i added to the Procfile :

web: java -Dserver.port=$PORT -jar ./cycle-api-webservice/target/cycle-api-webservice-0.0.1-SNAPSHOT.jar

and now it's working. The app was crashing after deployment if i didn't add the

-Dserver.port=$PORT

and now everything is ok !

Upvotes: 1

Related Questions