IntelliJ NoClassDefFoundError for jar Dependencies in other modules

I had a perfectly working Eclipse project with Maven and project dependencies. Now I want to switch to IntelliJ IDEA - importing my projects worked beautifully (now it is called a module with Maven and module dependencies), all Maven configurations seemed to work out of the box (you can expand the libraries and see the source code). When I run my module, I get:

Exception in thread "main" java.lang.NoClassDefFoundError: com/thoughtworks/xstream/XStream 

From the dependent module, xstream-1.4.2.jar is correctly located in the build path of this module.

What I tried and did not work:

  • Import projects as Eclipse projects, followed by Maven support / support framework
  • Import projects into Maven projects
  • Invalid Caches
  • Maven Reimport and generate update sources and folders

Which worked, but is not a solution: I can add xstream-1.4.2.jar depending on the module I am running, but then it does not work with the next missing jar. Thus, it seems that it does not find the bans specified in the reference modules.

Often there is a NoClassDefFoundError when the classpath has two libraries in different versions - I checked twice, there is only one xstream * .jar file.

I appreciate any help.

Thanks Marcel

+6
source share
1 answer

Is xstream-1.4.2.jar located in the correct groupid / artificatid / 1.4.2 / folder in the .m2 repository?

If you are working on linux, .m2 will be located in /home//.m2. If you are working on Windows, the .m2 folder will be located in the folder C: \ Users \ .m2

0
source

Source: https://habr.com/ru/post/953915/


All Articles