import com.app.abc.*;
abc is being displayed in red color.
verified the .m2/repository. dependency is downloaded.
tried reload of project... deleted all dependencies frm .m2 and downloaded again.. Still does not help
even tried mvn -U idea:idea
Also tried
**Right Clicking the pom.xml in Intellij-idea -> Maven - Reload Project.**
Tried File > Invalidate Caches / Restart...
Classes from the dependency are being shown in a list of recommendation by Intellij. But the import statement is causing the error
Related
I am getting below errors:
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not found
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not found
Dependency 'org.seleniumhq.selenium:selenium-java:3.141.59' not foundenter image description here
Once any changes are made in pom.xml you must refresh it by clicking on following button (see screenshot).
It will trigger Maven to refresh and download needed dependencies/plugins according to pom.xml file.
Please reload the pom.xml by mentioned in the picture.
right click -> maven -> Reload Project
I have multi module maven project in intelliJ 2019.3 (Ultimate)
I am not able to get all dependencies after several tries. I tried below solutions as well
Solution 1
Solution 2
I noticed under the Maven tool same module shows twice as below
Not sure that caused the issue here.
Strangely I don't see any red lines in the any of the POMs
Provided that you can build project from command line Maven and dependencies are downloaded.
In IntelliJ IDEA please try: File | New | Project from Existing Sources action and point to pom.xml file to import project from. Then choose to delete existing project configuration.
I am using Intelli J as the IDE and maven(3.3.9) as my build tool. After I completed my code in Java I was trying to add junit dependency to my pom.xml but maven doesn't seem to recognize the dependency. I came across a few other related questions on this issue but on trying all possible solutions exhaustively the problem still seems to persists.
My pom.xml currently looks like:
Following are the possible fixes I tried to alleviate the issue:
Downloading Library from Maven Repository from Project Structure
Specifying the junit dependency through the Project Structure (File > Project Structure > Libraries > New Project Library (from Maven)). I searched for junit and chose junit:junit:4.11 but I get "No files were downloaded"
Makes changes in the Project Setting for Maven
I went to File > Settings > Build,Execution,Deployment > Maven and I checked Use plugin directory and changed maven to the appropriate location. It looks like follows:
Following that I also went to File > Settings > Build,Execution,Deployment > Maven > Importing and checked Import Maven Projects automatically.
Running maven
Then I also ran maven clean install which ran with success after downloading some files:
Re-importing All Maven Projects
I also re-imported all maven projects from the Maven Projects tab on the right but I end up with unresolved plugins and the an error popup saying "Failed to read artifact descriptor for junit:junit:jar:4.11" when I hover over the red-lines.
Can someone tell me anything else I might have missed if you have ever encountered the same before ?
Thanks!
I'm using IDEA to write groovy scripts for my jenkins job. So I have these imports
import groovy.json.JsonSlurper
import hudson.FilePath
import hudson.model.Node
import hudson.model.Slave
import jenkins.model.Jenkins
Before I added jenkins-core-2.9.jar into the project dependency, those jenkins classes are marked in red. Then I added the jar as a dependency by "File"->"Project Structure"->"Modules"->"Dependencies"
Then those red marks are gone. However, when I tried to run the script, it says Error:(14, 1) Groovyc: unable to resolve class jenkins.model.Jenkins. What else do I need to do?
I had the same problem and it was a permission issue. For me this command fixed it: sudo chmod o=r jenkins-core-2.73.3.jar
As stated in this link,
Note that if you configure a dependency through the Project Structure dialog, the dependency will only appear in the IntelliJ IDEA Project tool window, not in the Gradle tool window.
Adding the dependency like this only adds the dependency in the idea workspace. When you run the task either from the gradle tool window, or from an external command line tool, that dependency no longer exists. You should add it to your gradle dependencies:
dependencies {
compile "org.jenkins-ci.main:jenkins-core:2.9"
}
You can configure a repository to load this dependency from. This repository can be a file path, or a maven repository etc.
See here for more details on gradle dependency management.
Maven on the intellij was unavailable(think removed).I can not make new maven project or import dependency form pom.xml using: right click->maven->reImport.No maven option exist when right click.
Maybe Maven integration is disabled.
Windows: Navigate File > Settings > Plugins
MacOS: Navigate Preferences > Plugins
Then switch to Installed tab, search for maven and click enable button.
https://www.jetbrains.com/help/idea/managing-plugins.html
It looks like the installation iscorrupted.
Remove the .IntellijXX or .IdeaICXX settings folder, which can be found under in the current user directory and after restarting Intellij, it should recreate everything fixing the problem.
Apart from getting the Maven option on right click on a project, there is a Maven option on the right hand side of intellij (As shown below, and highlighted). Click on the circle arrows icon for re-importing maven dependencies.
Usually if you open settings and search for the term "maven" you should be able to see under "Build, execution deployment" - "Maven" with its corresponding settings. The Maven Home directory should point to a valid maven installation. For example:
(unix
$ /home/xy/intellij/plugins/maven/lib/maven3
If that doesnt work, try to reinstall intellij by either through intellij (windows software remove) or removing the config files in your home directory
(unix)
$ /home/xy/.intellijXY
(windows)
%USERPROFILE%\.IdeaICXX
In the file menu select settings -> plugins.
search for maven, select maven, select enable. Restart intellij.
Once restarted you will now have the option to start new maven project and maven functionality will be accessible in all your previous projects.
Tried a few solutions but this is the only thing that worked. In short make sure maven is ON for you.
Try navigating to the pom.xml file and open as a project.
Maven is not integrated
Navigate to File > Settings > Plugins
Search for 'maven' here and add it
Click on enable and restart the intellij
You will be able to find 'maven'