在IntelliJ中找不到类文件 [英] Class file not found in IntelliJ

查看:2865
本文介绍了在IntelliJ中找不到类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IntelliJ中,当我尝试编译时,我得到了这个奇怪的错误。

In IntelliJ I get this weird error when I try to compile.

Cannot find annotation method 'cascade()' in type 'javax.persistence.ManyToOne': class file for javax.persistence.ManyToOne not found

我知道,似乎很明显问题是什么,但是花了太多时间在这个问题上,我现在把信任交给你了!

I know, it seems pretty obvious what the problem is, but having spent too much time on this problem I now turn my trust to you!

我使用ideaCommunity-9,我在哪里为JBoss创建了一个全局库,其中包含所有JBoss jar,包括ejb3-persistence.jar。我的模块包含这个库,我已将其移至依赖项的顶部。
类路径中没有其他地方我有一个javax.persistence.ManyToOne类,它也可以在IntelliJ中打开而没有问题。

如果我打开文件,我收到编译错误,IntelliJ显示没有问题,并按Ctrl + B导航到类文件。

代码也是用ant构建的,这里工作正常。

I use ideaCommunity-9, where I have created a global library for JBoss, which contains all JBoss jars including ejb3-persistence.jar. My module includes this library, and I have moved it to the top of dependencies. No otherwhere in classpath I have a javax.persistence.ManyToOne class, and it also opens up in IntelliJ without problems.
If I open the file where I get the compile error, IntelliJ shows no problems and also navigates to the class file on pressing Ctrl+B.
The code is also build with ant and here it works fine.

除此之外上面的错误我在同一条路径上得到了另外六个(表中的名字等) - 都与JPA有关。我还收到一条消息说请向JDC yada yada yada提交一个错误。

Besides the above error I get six others along the same path (name in Table, etc.) - all related to JPA. I also get a message saying "Please file a bug to JDC yada yada yada."

推荐答案

尝试勾选一个复选框导出在您的依赖项中。

Try to tick a checkbox "export" in your dependencies.

我的意思是:文件菜单 - >项目结构 - >模块 - >依赖项,您可以在其中看到模块中包含的库。您还应该在导出列中的每个库附近看到一个复选框。

I mean: "File" menu -> Project Structure -> Modules -> Dependencies, and there you can see libs included to the module. You should also see a checkbox near each lib in column 'Export'.

这篇关于在IntelliJ中找不到类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆