Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. #56

Open
jansenm opened this issue Apr 6, 2020 · 1 comment

Comments

@jansenm
Copy link

jansenm commented Apr 6, 2020

The buildpack has a conceptual problem.

Compile installs the required jdk and sets the required environment variable JAVA_HOME, then calls gradlew <buildCommand> .

Test-Compile first executes Compile and then calls gradlew resolveTestRuntime without setting JAVA_HOME so it fails with the error in the title. Unless naturally your image has a java in $PATH which might or might not be the one you wanted to use. But the script just exits, the buildpack call doesn't return an error. So the pipeline continues. I guess its not a problem if you don't have testRuntimeDependencies.

The Test step btw. doesn't do much setup either so it downloads gradlew a second time before executing the tests.

Test-Compile probably should source Compile.

Test should get the needed configuration so it doesn't download gradlew twice

@hassanmohaideen
Copy link

Hi, wanted to see if there is a solution or work around for this? I am currently getting this error -

       > Task :compileJava NO-SOURCE
       > Task :classes UP-TO-DATE
       > Task :jvmMainClasses
       > Task :compileTestKotlinJvm
       > Task :compileTestJava NO-SOURCE
       > Task :testClasses UP-TO-DATE
       
       BUILD SUCCESSFUL in 1m 12s
       4 actionable tasks: 4 executed
-----> Resolving testRuntime dependencies...
       
       ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
       
       Please set the JAVA_HOME variable in your environment to match the
       location of your Java installation.
       
 !     Could not detect buildpack https://github.com/heroku/heroku-buildpack-java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants