问题描述
所以我在 IntelliJ 中有一个 Maven 模块(模块-A).我最近将一些类从它移到另一个新的 maven 模块(模块-B)中并添加了一个依赖项.完成此操作后,我还修改了其中一个移动类(现在在模块 B 中)的方法的签名.
So I have a maven module (module-A) in IntelliJ. I recently moved some classes from it into another new maven module (module-B) and added a dependency to it. Once I had done this I also modified the signature of a method of one of the moved classes (now in module-B).
我重新导入了 poms,以便 IntelliJ 能够获取依赖项更改并确保受影响文件的所有 Java 导入再次正确.现在,当我尝试运行我的 web 应用程序(这取决于两个模块)时,我在模块 A 中的类中调用模块 B 中类的修改方法时遇到编译错误.
I re-imported the poms so that IntelliJ would pick up the dependency changes and ensured all Java imports for the affected files were correct again. Now when I attempt to run my webapp (which depends on the two modules) I get a compile error in a class in module-A calling the modified method of the class in module-B.
错误消息基本上是说该方法不存在但认为旧方法仍然存在!我点击'make'错误,它把我带到模块A中的一个类中的行,调用修改后的方法......奇怪的是,IntelliJ知道它在文件中没问题.即该方法没有像编译错误通常那样用红色下划线,但类文件名是:(
The error message is basically saying that that method doesn't exist but believes the old method still exists! I click on the 'make' error and it takes me to the line in a class in module-A calling the modified method...the weird thing is, IntelliJ knows it is fine in the file. i.e. The method is not underlined in red like a compile error would normally be, but the class file name is :(
我使用mvn install"(还安装了模块-B)从命令行编译了它,并且一切都成功了.我已经删除了模块 A 和模块 B 的目标中的类目录,并使 IntelliJ 的缓存无效并重新启动......仍然发生......有任何想法吗?
I compiled it from the command line using 'mvn install' (having also installed module-B) and it is all successful. I have deleted the classes directory in the target of both module-A and module-B and also invalidated IntelliJ's caches and restarted...still happening...any ideas?
推荐答案
所以今天早上刚说出来,一切正常!
So just stated it up this morning and it's all working!
昨晚我所做的是从模块 A 和模块 B 的父 pom 打开一个新项目(intelliJ 项目)并成功构建它,可能这样做然后再次打开我的原始项目以某种方式修复它...虽然很烦
Last night what I did do was open a new project (intelliJ project) from module-A's and module-B's parent pom and successfully got it to build, possibly doing that and then opening my original project again fixed it somehow...very annoying though
这篇关于IDEA JetBrains IntelliJ - 'make' 上的编译错误,但使用 Maven 编译时很好,并且 IntelliJ 在类文件中没有报告错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!