JRebel不会重新加载更改

时间:2017-12-03 15:30:37

标签: spring-boot jhipster jrebel

我有一个用jhipster(spring-boot)构建的项目 使用Eclipse IDE中的Run Configuration运行我的项目:

clean spring-boot:run -Dmaven.test.skip="true" -Drebel.remoting_plugin="true"

每次保存更改时,jrebel都会给出如下错误:

[2017-12-03 22:15:55] [Project my-project, server localhost] Connecting to server to sync project
[2017-12-03 22:15:55] Unexpected response from server. Raw Headers: {date=Sun, 03 Dec 2017 15:15:55 GMT, allow=GET, HEAD, expires=0, transfer-encoding=chunked, x-xss-protection=1; mode=block, x-content-type-options=nosniff, connection=keep-alive, content-type=application/json;charset=UTF-8, cache-control=no-cache, no-store, max-age=0, must-revalidate, pragma=no-cache, x-application-context=my-project:swagger,dev:8080}
[2017-12-03 22:15:55] Unexpected response from server. First kilobyte of content:
[2017-12-03 22:15:55] {
  "timestamp" : "2017-12-03T15:15:55.499+0000",
  "status" : 405,
  "error" : "Method Not Allowed",
  "exception" : "org.springframework.web.HttpRequestMethodNotSupportedException",
  "message" : "Request method 'POST' not supported",
  "path" : "/"
}

[2017-12-03 22:15:55] [Project my-project, server localhost] Synchronization failed! JRebel remote server did not respond. The remote server has to be started with the JVM argument: -Drebel.remoting_plugin=true.
[2017-12-03 22:15:55] Synchronization took 42 ms in total.

实际发生了什么? 怎么解决这个?

我的环境:
- macOS
- jRebel 7.1.3
- spring-boot 1.5.9.RELEASE

提前感谢。

1 个答案:

答案 0 :(得分:4)

TL; DR

请勿使用-Drebel.remoting_plugin=true

而是使用帮助> JRebel>配置>启动>从命令行本地运行。

长版本。

根据您的描述,听起来您正在自己的计算机上运行Spring Boot应用程序。

仅当实际应用程序位于您正在使用的IDE(eclipse)的不同计算机(或虚拟机)上时,才应使用参数-Drebel.remoting_plugin=true

您也不需要使用JRebel Eclipse插件synchronize功能。 JRebel将自己监视target/classes目录中类文件的更改。 使用Eclipse或mvn compile构建项目时,JRebel将检测更改并重新加载类。

因此,删除远程参数,而不是使用以下说明:在Eclipse中,转到帮助> JRebel>配置>启动>从命令行本地运行。然后选择您的JVM和Spring Boot。

查找Maven Spring Boot插件的说明,并使用它们将JRebel代理添加到您的应用程序中。

此外,您不能通过将JVM参数添加到命令的末尾来将其添加到spring-boot:run。相反,您应该将参数添加到MAVEN_OPTS环境参数中,或者使用-Drun.jvmArguments="-Dsome.argument"

传递它们