【问题标题】:Everytime i do any changes to java code, it won't reflect after i saves the file [closed]每次我对java代码进行任何更改时,它都不会在我保存文件后反映出来[关闭]
【发布时间】:2021-02-02 20:29:50
【问题描述】:

我在我的 java 项目中使用 Eclipse Neon,每次我对 java 代码进行任何更改时,在我保存文件后它不会反映(例如:一个简单的 syso 语句)。我必须执行 ma​​ven clean 和 maven install 我的项目,然后重新启动。

【问题讨论】:

  • Eclipse Neon 落后了 11 个版本。不要浪费时间使用过时的软件。请告诉用于运行它的命令行(在运行配置中有一个按钮显示命令行来获取命令行)。

标签: java eclipse spring-boot maven eclipse-jee


【解决方案1】:

在 pom.xml 中将 devtools 依赖项添加到您的项目(如果是 spring boot 项目):-

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-devtools</artifactId>
</dependency>

并在 Eclipse 中启用自动构建:-

【讨论】:

  • 自动构建已经启用,除非我 maven clean install 并且我厌倦了在 pom.xml 中添加上述更改,否则任何代码都不会反映它给我这个错误
  • 应用程序运行失败原因:org.springframework.context.ApplicationContextException:由于缺少 ServletWebServerFactory bean,无法启动 ServletWebServerApplicationContext。在 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:205) ~[spring-boot-2.3.4.RELEASE.jar:2.3.4.RELEASE] –
  • 请显示您的 pom.xml 和堆栈跟踪
  • org.springframework.bootspring-boot-starter-data-rest2.2.5.RELEASEorg.springframework.bootspring-boot-starter-quartzpomorg.springframework.bootspring-boot-devtools1.5.3.RELEASE依赖>
  • 分享完整的 pom.xml 而不仅仅是几个依赖项
【解决方案2】:

确保Project-&gt;Build Automatically 中的“自动构建”选项已启用。

也尝试使用 Mvn > update project 更新项目

【讨论】:

  • 自动构建已经启用,除非我 maven clean install 并且我厌倦了在 pom.xml 中添加上述更改,否则任何代码都不会反映它给我这个错误:
猜你喜欢
  • 2012-03-09
  • 2021-10-23
  • 1970-01-01
  • 2020-10-12
  • 1970-01-01
  • 2018-10-09
  • 2018-01-04
  • 2018-01-31
  • 1970-01-01
相关资源
最近更新 更多