IntelliJ NoClassDefFoundError用于其他模块中的jar依赖关系 [英] IntelliJ NoClassDefFoundError for jar Dependencies in other Modules

查看:113
本文介绍了IntelliJ NoClassDefFoundError用于其他模块中的jar依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完美的Eclipse项目与Maven和项目依赖关系。现在我想切换到IntelliJ IDEA - 我的项目的导入工作很好(现在称为模块与Maven和模块依赖关系),所有的Maven配置似乎都可以开箱即用(可以扩展lib和查看源代码)。
当我运行我的模块时,我得到:

 线程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屋!

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