Search code examples
javamavenherokujhipsterheroku-toolbelt

jhipster application deployment to Heroku giving error


I am trying to deploy my jhipster generated application to heroku using ubuntu. When I type:

echo $JAVA_HOME

, I am getting /usr/lib/jvm/java-8-oracle

But while deploying the application to heroku using jhipster command, I am getting the below error.

    sudo jhipster heroku


Using JHipster version installed locally in current project's node_modules
Executing jhipster:heroku
Options: 
Heroku configuration is starting
Deploying as existing app: infinite-savannah-43112

Using existing Git repository

Heroku CLI deployment plugin already installed

Provisioning addons
No new addons created

Creating Heroku deployment files
identical src/main/resources/config/bootstrap-heroku.yml
identical src/main/resources/config/application-heroku.yml
identical Procfile
identical pom.xml
identical pom.xml

Building application
✖ { Error: Command failed: ./mvnw verify -DskipTests=true -B -Pprod
Error: JAVA_HOME is not defined correctly.
  We cannot execute /usr/lib/jvm/java-9-openjdk-amd64/bin/java/bin/java

    at ChildProcess.exithandler (child_process.js:272:12)
    at ChildProcess.emit (events.js:160:13)
    at maybeClose (internal/child_process.js:943:16)
    at Socket.stream.socket.on (internal/child_process.js:363:11)
    at Socket.emit (events.js:160:13)
    at Pipe._handle.close [as _onclose] (net.js:562:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: './mvnw verify -DskipTests=true -B -Pprod' }
Congratulations, JHipster execution is complete!

Even my JAVA_HOME is pointing to Java-8-oracle, why jhipster throwing error saying JAVA_HOME is pointing to something else and any fix for this


Solution

  • If you manually edit the herokuDeployType value in your .yo-rc.json to this:

    "herokuDeployType": "git"
    

    Then the next time you run jhipster heroku it will run Maven on Heroku.