IntelliJ NoClassDefFoundError用于其他模块中的jar依赖关系 [英] IntelliJ NoClassDefFoundError for jar Dependencies in other Modules
问题描述
当我运行我的模块时,我得到:
线程main中的异常java.lang.NoClassDefFoundError:com / thinkworks / xstream / XStream
从依赖模块中,xstream-1.4.2.jar在构建该模块的路径。
我尝试并没有工作:
- 将项目导入Eclipse项目,然后应用Maven自然/框架支持
- 将项目导入为Maven项目
- 无效缓存
- Maven Reimport &安培;生成源和更新文件夹
有什么工作但不是解决方案:我可以将xstream-1.4.2.jar添加到依赖项我正在运行的模块,但是随着下一个丢失的jar失败。所以看起来好像没有在引用的模块中找到引用的jar。
当类路径中不同版本中有两个lib时,通常会遇到NoClassDefFoundError - 双重检查,那里只有一个xstream * .jar文件。 >
感谢任何帮助。
谢谢Marcel
xstream-1.4.2.jar是否位于.m2存储库下的正确groupid / artificatid / 1.4.2 /文件夹中?
如果您在linux上运行,则.m2将位于/home//.m2
下如果您正在Windows上运行,则.m2文件夹将位于C:\Users\.m2
I had a perfectly running Eclipse project with Maven and project dependencies. Now I want to switch to IntelliJ IDEA - the import of my projects worked nicely (now called module with Maven and module dependencies), all the Maven configuration seemed to work out of the box (can expand libs and see source code). When I run my module I get:
Exception in thread "main" java.lang.NoClassDefFoundError: com/thoughtworks/xstream/XStream
From a dependent module, xstream-1.4.2.jar is correctly in the build path of that module.
What I tried and did not work:
- Importing projects as Eclipse projects, applying Maven nature/framework support afterwards
- Importing projects as Maven projects
- Invalidate caches
- Maven Reimport & Generate Sources and Update Folders
What worked but is not a solution: I can add the xstream-1.4.2.jar to the dependencies of the module I am running, but then it fails with the next missing jar. So it seems as if it does not find the jars referenced in referenced modules.
Often one encounters the NoClassDefFoundError when there are two libs in different versions on the classpath - I double checked, there is only one xstream*.jar file there.
I appreciate any help.
Thank you, Marcel
Is xstream-1.4.2.jar located in the correct groupid/artificatid/1.4.2/ folder under .m2 repository?
If you are running on linux, .m2 will be located under /home//.m2 If you are running on Windows, .m2 folder will be located under C:\Users\.m2
这篇关于IntelliJ NoClassDefFoundError用于其他模块中的jar依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!