简体   繁体   中英

How to show gradle stacktrace on heroku deployment?

I'm attempting to deploy a gradle java app to heroku (based on jhipster). I can build and run it locally with "heroku local", but when I attempt to deploy it remotely I get an error when it attempts to build the application (while executing ./gradlew stage). The error is:

...
remote:        Download https://oss.sonatype.org/content/repositories/releases/org/mapstruct/mapstruct-processor/1.0.0.CR1/mapstruct-processor-1.0.0.CR1.pom
remote:        Download https://oss.sonatype.org/content/repositories/releases/org/mapstruct/mapstruct-processor/1.0.0.CR1/mapstruct-processor-1.0.0.CR1.jar
remote:        :bower FAILED

remote:        FAILURE: Build failed with an exception.
remote:        
remote:        * What went wrong:
remote:        Execution failed for task ':bower'.
remote:        > A problem occurred starting process 'command 'bower''
remote:        
remote:        * Try:
remote:        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
remote:        
remote:        BUILD FAILED

I imagine if I could see the stacktrace it may clarify the problem, but I don't know how to pass in a command line argument (--stacktrace) to a gradle build on the heroku remote server. I would try it manually with a (heroku run bash) but I can't since this is the first deploy and there is no code on the dyno yet.

This error means that the bower command is not available. In order to add it to the build, you will need to add the Node.js buildpack to your app by running these commands:

$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/nodejs
$ heroku buildpacks:add heroku/gradle

This will run the Node.js buildpack first (after you git push ), which will install node and any dependencies in your package.json . Then it will run the Gradle buildpack.

There are a few other things you might have to configure, and I have a blog post on doing this with Maven . But in general the same principles apply for Gradle.

You can also deploy to Heroku using the heroku deploy plugin .

./gradlew clean -Pprod bootRepackage -x test
heroku deploy:jar --jar build/libs/*.war

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM