[英]Intellij IDEA doesn't detect changes
Yesterday I refactored my project and I changed layout of my packages (I moved some packages into another packages, created new packages etc).昨天我重构了我的项目并更改了包的布局(我将一些包移动到另一个包中,创建了新包等)。 But now, when I try to run JUnit test I get NoSuchMethodError
on methods which name is changed after refactoring.但是现在,当我尝试运行 JUnit 测试时,我在重构后更改名称的方法上得到NoSuchMethodError
。 Also, when I change other code in methods, IDEA still running old code.. I tried to run "Invalidate caches" in File menu, also I tried to reboot computer - no result.此外,当我更改方法中的其他代码时,IDEA 仍在运行旧代码。我尝试在文件菜单中运行“无效缓存”,也尝试重新启动计算机 - 没有结果。 Where can be problem?哪里可能有问题?
EDIT: Yesterday after moving packages IDEA doesn't correctly change package declarations in .java
files, so I changed them by hand编辑:昨天移动包后,IDEA 没有正确更改.java
文件中的 package 声明,所以我手动更改了它们
当 Intellij 突然停止注意到变化时,VCS -> Refresh File Status 为我解决了这个问题。
SOLUTION:解决方案:
Error magically gone after 2 things:错误在两件事之后神奇地消失了:
I imported this project into eclipse and run JUNit test from eclipse.我将这个项目导入到 eclipse 中并从 eclipse 运行 JUNit 测试。 Then I returned to IDEA and deleted all Eclipse specific files.然后我返回到 IDEA 并删除了所有 Eclipse 特定文件。
I synchronized my project (File->Synchronize).我同步了我的项目(文件->同步)。
I don't know what actually was the solution of problem, but for suggestions I accept @SeanLandsman's answer我不知道问题的实际解决方案是什么,但对于建议,我接受@SeanLandsman 的回答
Answer to an old question, but:回答一个老问题,但是:
If you're using a Run Configuration, make sure in the "Before Launch" section of the "Run/Debug Configurations" dialog, you have added "Build".如果您使用的是运行配置,请确保在“运行/调试配置”对话框的“启动前”部分中添加了“构建”。 It seems to get removed from this dialog sometimes, even if you have it added in the default settings.它似乎有时会从此对话框中删除,即使您已将其添加到默认设置中。
I have two suggestions you could try here我有两个建议你可以在这里试试
With regards to your edit - I've not seen this myself.关于您的编辑 - 我自己没有见过。 Whenever I've renamed or moved files (including packages) these changes have been correctly applied to all applicable files.每当我重命名或移动文件(包括包)时,这些更改都已正确应用于所有适用的文件。 Are you refactoring with Refactor>Move / Refactor->Copy ?您是否使用 Refactor>Move / Refactor->Copy 进行重构?
删除类目录的全部内容对我有用
Another root-cause can be:另一个根本原因可能是:
If you are using Lombok, try to deinstall/reinstall the Intellij Lombok Plugin.如果您使用的是 Lombok,请尝试卸载/重新安装 Intellij Lombok 插件。
That solved such a strange behaviour in my case!就我而言,这解决了这种奇怪的行为!
尝试删除抛出 nosuchmethod 错误的类的 .class 文件,然后重新编译。
This worked for me.这对我有用。
In IntelliJ IDEA,在 IntelliJ IDEA 中,
Then you can navigate to Local Changes Tab.然后您可以导航到本地更改选项卡。
Found this posting from IntelliJ and Maven not finding POM changes.从 IntelliJ 和 Maven 中找到此帖子,但未找到 POM 更改。 Had to Reload All Maven projects to fix it.必须重新加载所有 Maven 项目来修复它。 Maven panel, upper left corner circle of arrows button. Maven 面板,箭头按钮的左上角圆圈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.