'new dependency not recognised by Maven
Using maven version 3.6.3 and JDK version "openjdk-17"
I've tried using Maven's dependencies so I could use the xstream library in my project. Following a guide I added com.thoughtworks.xstream to my pom.xml file:
I then tried to use xstream, but intellij couldn't resolve "XStream" even though it seems to work for JavaFX just fine. This code does not compile.
EDIT: I loaded a new project, where I used, what I believe to be, up to date versions. Maven 3.8.1, the latest intellij version, and everything else (JDK, openjfx) at version 17.0.2 yet when I try to use "XStream" in my project code (after reloading the maven project) it says "Cannot resolve symbol XStream"
Edit 2: I added junit to the dependencies, it works. I add Gson to the dependencies. It doesn't work.
Solution 1:[1]
Solution 2:[2]
One of the following may solve your problem: These are based on my previous experiences.
- because may be auto import disabled. re Import maven project.(intellij: press Ctrl+Shift+A then actions - input "reload" find "Reload All Maven Projects").
- in my experience, sometimes it does happen that the dependency is not fully received. remove xstream special version folder from .m2 (com->thoughtworks->xstream) and repeat step 1.
- maybe repository not valid. check repository source in file settings.xml in .m2 (if exist) or replace to other source.
- invalid cache and restart (intellij: file-> invalid caches/restart). This has solved my problem several times.
- Your access to the site or repository may be closed. check network policy or use vpn (Poor probability)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | James Green |
| Solution 2 |






