我正在尝试将 gradle java 应用程序部署到 heroku (基于 jhipster)。我可以使用“heroku local”在本地构建并运行它,但是当我尝试远程部署它时,当它尝试构建应用程序时(在执行 ./gradlew 阶段),我会收到错误。错误是:
...
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
我想如果我能看到堆栈跟踪,它可能会澄清问题,但我不知道如何将命令行参数(--stacktrace)传递给heroku远程服务器上的gradle构建。我会使用 (heroku run bash) 手动尝试,但我不能,因为这是第一次部署,而且测功机上还没有代码。
最佳答案
此错误意味着 bower
命令不可用。为了将其添加到构建中,您需要通过运行以下命令将 Node.js 构建包添加到您的应用程序中:
$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/nodejs
$ heroku buildpacks:add heroku/gradle
这将首先运行 Node.js 构建包(在 git Push
之后),它将在您的 package.json
中安装 Node 和任何依赖项。然后它将运行 Gradle 构建包。
您可能还需要配置一些其他内容,我有一个 blog post on doing this with Maven 。但总的来说,同样的原则也适用于 Gradle。
关于java - 如何在heroku部署上显示gradle stacktrace?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33536141/