简体   繁体   English

Eclipse IDE 调试 - 代码未反映新更改

[英]Eclipse IDE debugging - code not reflects new changes

I'm using Eclipse IDE (4.2).我正在使用 Eclipse IDE (4.2)。 When I make a change in Eclipse and try to debug it, the previous version is compiled, but not the new one.当我在 Eclipse 中进行更改并尝试调试它时,会编译以前的版本,但不会编译新版本。 To get around this, I do maven clean/build and then refresh the project.为了解决这个问题,我做了 maven clean/build 然后刷新项目。 But this is very tedious and I need to do it every time I make any changes.但这非常繁琐,每次进行任何更改时都需要这样做。 Is there another way around this or a plugin that I can use to pick up these changes automatically?是否有另一种解决方法或插件可以用来自动获取这些更改?

Click Project > Build Automatically once and make sure that tick mark is appeared in front of Build Automatically option. 单击Project > Build Automatically一次,并确保在Build Automatically选项前面显示对勾。

Also you have to enable hot code replace options. 另外,您还必须启用热代码替换选项。 Click Windows > Preferences . 单击Windows > Preferences Go to Java > Debug select all options in Hot Code Replace group 转到Java > Debug在“ 热代码替换”组中选择所有选项

I had the same problem and these steps fixed it: 我遇到了同样的问题,这些步骤解决了该问题:

  • Run -> Run configurations 运行->运行配置
  • Select the one giving the problem 选择一个给出问题的
  • Go to the Source tab 转到“源”选项卡
  • Make sure your project is the first entry there 确保您的项目是那里的第一个条目
  • Mine had just the Default set there so I had to do this: Add -> Java Project -> Select your Project and add it 我的只是在那里设置了默认值,所以我必须这样做:添加-> Java项目->选择您的项目并添加它

I had the same problem, the reason was a wrong configuration of the javabuilder in the .project managed by eclipse.我有同样的问题,原因是eclipse管理的.project中javabuilder的配置错误。 I opened it and rewrited the buildspec section so that either maven or jdt.core can compile.我打开它并重写了 buildspec 部分,以便 maven 或 jdt.core 都可以编译。 Once done, relaunch eclipse and if the Project > Build Automatically option is enabled, any change should now be reflected :完成后,重新启动 eclipse,如果启用了Project > Build Automatically选项,现在应该反映任何更改:

<?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
  <name>ProjectName</name>
  <comment>My beautiful project</comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.m2e.core.maven2Builder</name>
        <arguments>
        </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
 </projectDescription>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM