【问题标题】:Gradle does not work with spring boot sample app. Why not?Gradle 不适用于 Spring Boot 示例应用程序。为什么不?
【发布时间】:2015-12-27 21:41:43
【问题描述】:

我正在使用这个 Spring Boot 教程来学习 Spring Boot。我明确地遵循了这些步骤,但现在 gradle 无法正常工作。我记得在运行它的 CentOS 7 devbox 中安装了 gradle。 如何获得 gradle 来启动这个示例应用?

这是终端日志 从使用上面列出的教程中的确切步骤创建的应用程序的根目录键入:

[root@localhost gs-actuator-service]# ./gradlew bootRun --stacktrace
-bash: ./gradlew: No such file or directory
[root@localhost gs-actuator-service]# ./gradlew bootRun --debug --stacktrace
-bash: ./gradlew: No such file or directory
[root@localhost gs-actuator-service]# ./gradlew bootRun
-bash: ./gradlew: No such file or directory
[root@localhost gs-actuator-service]# 

我还通过输入以下内容确认机器上安装了 gradle:

[root@localhost gs-actuator-service]# gradle -v

------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time:   2015-12-21 21:15:04 UTC
Build number: none
Revision:     276bdcded730f53aa8c11b479986aafa58e124a6

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_45 (Oracle Corporation 25.45-b02)
OS:           Linux 3.10.0-327.3.1.el7.x86_64 amd64

[root@localhost gs-actuator-service]# 

【问题讨论】:

    标签: java spring gradle build.gradle gradlew


    【解决方案1】:

    如果您使用./gradlew,当然它只在该示例项目中包含 Gradle Wrapper 时才有效,即如果脚本gradlew 存在于该项目的根目录中。如果您想使用本地 Gradle 安装,请像这样执行:

    gradle bootRun
    

    【讨论】:

    • 感谢您和 +1 的快速和正确回复。
    猜你喜欢
    • 2018-03-21
    • 1970-01-01
    • 2021-05-29
    • 2015-07-07
    • 2020-05-25
    • 2018-08-25
    • 2015-06-28
    • 2022-01-06
    • 2017-01-31
    相关资源
    最近更新 更多