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.
I figured out that in the "modules-info.java" file, "requires xstream" is needed. That is all
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)
I'm using IntelliJ IDEA Community 2020.2.3.
My project is built around Kotlin 1.3.30 and Java 11.
I've upgraded one of my dependecy to java 11 too, and after that, the IDE shows the dependency under "External Libraries", it build the app without errors, Maven build it from terminal without error, but the IDE shows unresolved references on each occurrency of the classes, functions and imports of that library.
I already tried to empty the cache or deleting idea files and importing again the project, but none of those worked.
Any tips?
You can use CTRL+SHIFT+A and look for Load Maven Changes or CTRL+SHIRT+O to do the same thing
I am not quite sure what has happened to my IntelliJ recently but any new projects created or checked out from a repo are unable to resolve the dependencies from maven.
Resulting in lots of unresolved class symbols.
Interestingly projects that have already existed work fine and IntelliJ can resolve the dependencies imported by Maven.
So something has happened within the space of the last two weeks that has caused this issue. I haven't touched the Intellij config
This is what I have done to troubleshoot:
clear cache in intellij
mvn clean and install
reimport through maven on intellij
download sources and documentation
remove maven pom and re-add it
checked m2/repository cache, which contains the libraries
IntelliJ version - 2018.2
Any ideas?
I have an issue with my Eclipse Neon configuration on my maven project. The issue that appears many times is the following The superclass "java.servlet.http.HttpServlet" was not found on the java build path. I know there were few posts about that and know also that there is two solutions. The first one is to add a Tomcat server on runtime and the second one is to add servlet dependency in the pom.xml.
As it's an SVN project, the depedency was already in it and anyone in my team has a Tomcat configured on runtime but the project is building well on their eclipse.
Any idea ?
The problem was that I had some errors when I built the project for the first time. The solution was to empty the m2 folder which is the local maven repository, then clean and build and it works.
You can also resolve this issue by Updating the Maven dependencies in your project. You can do this by
Right click on the project -> Maven -> Update Project
I have a toy Java project set up with Gradle in IntelliJ IDEA 13.1.2. It compiles and runs fine, but the IDE highlights 'google' in
import com.google.common.base.Strings;
as red and warns "Cannot resolve symbol 'google'". Any idea how to fix it?
I have tried 1) deleting .idea/ and re-creating the project in IntelliJ IDEA, and 2) re-importing project from the manually created Gradle configuration file build.gradle, but to no avail.
I think user Sap is correct, at least in my case. You should not have to manually add the dependency.
Did you change the dependencies in the gradle file without syncing intellij? Try this button:
For more information, see:
https://www.jetbrains.com/idea/help/synchronizing-changes-in-gradle-project-and-intellij-idea-project.html
Check this.
You can simply open Gradle tool window at [ View ] - [ Tool Windows ] - [ Gradle ].
In the window, you can refresh by clicking refresh button.
All dependencies manually added directly into build.gradle file will be resolved.
One of the solutions that worked for me after trying everything listed on the internet to solve this issue was to install the lombok plugin.
Got to File --> Settings --> Plugins and look for Lombok.
Make sure the "Enable annotation processing" is ticked
My Gradle project is using Intellij 2019.2.3, and File->Invalid Cache/Restart... doesn't work, but View->Tool Windows->Gradle->sync(the circular icon) works instantly.
In my case, I have to do the following:
close project
close idea
remove .idea project directory
remove (idea.system.path) directory
start idea
You can find your idea.system.path here: https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs
What helped me was checking "dependencies" in "project settings/modules" section. Apparently, Idea did not pick up them correctly.
Steps which worked for me:
delete all modules from "project settings/modules"
refresh the project from Gradle plugin - that triggers generation of modules
This trick helped me to get modules with correct dependencies generated.
Probably it happened because initially, I imported the project as non-Gradle one.
It turns out that the depended packages need to be separately specified in IntelliJ IDEA in addition to build.gradle and explicitly added as a dependency. Namely,
download the com.google.guava package following the instruction in documentation -- I picked com.google.guava:guava-base:r03 to download
follow the automatically-prompted window to add it as a project library to the Java project.
Specify that the Java module depends on the com.google.guava package in the project settings. See the documentation instruction "Configuring Module Dependencies and Libraries".
In my case (Apache Beam sources) a ./gradlew clean was needed.
In My Case, I've Updated the Gradle version(module: project) from 3.2.2 to 3.5.2, and also there was a problem with the NDK file location it was on the wrong path, I've just switched it to the default NDK path, then invalidate and restart the project.
I was having the wrong import.Check if you have right import. In case you have imported using:
import org.junit.Test
and you have org.junit.jupiter.api.Test in class path, try importing with :
import org.junit.jupiter.api.Test;