【问题标题】:Why does the bootRun task of my Spring Boot application not run completely in Gradle?为什么我的 Spring Boot 应用程序的 bootRun 任务没有在 Gradle 中完全运行?
【发布时间】:2016-11-28 19:51:35
【问题描述】:

我想通过在 Chrome 中添加 org.springframework.boot:spring-boot-devtools 依赖项和 LiveReload 扩展来使用 Spring Boot 工具的自动重启和实时重新加载功能。有关更多信息,请参阅此https://spring.io/blog/2015/06/17/devtools-in-spring-boot-1-3。但是,这不起作用,因为当我从 STS 或命令提示符运行 bootRun Gradle 任务时,应用程序已启动(并且在 http://localhost:8080 上可用)但是任务的启动永远不会完成并且永远不会超过 70% / 80 % 标记。这会阻止自动重启功能。

我的 gradle 文件看起来像这样。本项目的完整源码可以在 GitHub 中找到,见https://github.com/marinusgeuze/metjekindnaarbuiten/tree/master/backend/springboot

================================================ ===============

buildscript {

    ext { springBootVersion = '1.4.3.BUILD-SNAPSHOT' }

    repositories {
       jcenter()
       maven { url "http://repo.spring.io/snapshot" }
       maven { url "http://repo.spring.io/milestone" }
    }

    dependencies {
       classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
       classpath('se.transmode.gradle:gradle-docker:1.2')
    }
}

group = 'marinusgeuze'

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'docker'

jar {
    baseName = 'metjekindnaarbuiten-spring-boot-docker'
    version =  '0.1.0'
}

repositories {
    jcenter()
    maven { url "http://repo.spring.io/snapshot" }
    maven { url "http://repo.spring.io/milestone" }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
   compile("org.springframework.boot:spring-boot-starter-web")
   compile("org.springframework.boot:spring-boot-starter-data-jpa")
   compile("org.springframework.boot:spring-boot-devtools")
   compile("com.h2database:h2")
}

【问题讨论】:

  • 你为什么要这样做?只需直接从 STS 运行应用程序即可。
  • 有时问题的答案很简单。你是完全正确的。只需转到 Project > Debug As > Spring Boot App 就可以了。在 Chrome 中安装 LiveReload 插件,效果很好。非常感谢。

标签: gradle spring-boot build.gradle


【解决方案1】:

有时问题的答案很简单。你是完全正确的。只需转到 Project > Debug As > Spring Boot App 就可以了。在 Chrome 中安装 LiveReload 插件,效果很好。非常感谢。

【讨论】:

    猜你喜欢
    • 2016-04-15
    • 1970-01-01
    • 2016-09-17
    • 2019-11-09
    • 2019-01-31
    • 2023-02-10
    • 1970-01-01
    • 1970-01-01
    • 2014-06-30
    相关资源
    最近更新 更多