I recently updated my IntelliJ and I am having a problem with it showing import statements as nonexistent in the classpath despite the project building fine by doing mvn clean [install|verify] from the command line and the software actually works. So the dependencies are certainly there but the IDE seems to have a bug synchronizing against the pom file. I have tried to Maven --> Reimport multiple times, without success.
Considering that I recently updated IntelliJ (the version is as of 7/15/2017), could this be a newly introduced bug and is there a workaround?
The problem may be caused by a known bug in Maven integration which affects 2017.2 version. This bug is fixed in 2017.2.1 version.
You can find out if it's the case of your problem by searching idea.log for:
java.lang.AbstractMethodError: org.jetbrains.idea.maven.server.embedder.CustomModelValidator$ProxyModelProblemCollector.add(Lorg/apache/maven/model/building/ModelProblemCollectorRequest;)V
Related
i've created a project with Jhipster, when i open the project with IntelliJ i have these problems in pom.xml:
pom.xml problems
I tried maven clean/package/install, the first two run successfully but when i run maven install a test fails:
test failure
I also tried to use plugin registry (in maven settings) and invalidate caches but still not work. In the end i tried different JDK but i have the same problems. Can someone help me please?
I use JDK 11.0.15, Node 16.15.1, Git 2.36.1 and i'm on windows 10.
For those interested in troubleshooting pom.xml i solved by updating the repository (on IntelliJ go file/settings/build, execution, deployment/build tools/maven/repositories both remote and local) and reloading all maven projects.
I've been using Intellij and Mockito for years with no issue, but I have a problem on one of my Gradle projects where some parts of Mockito are not recognized as expected, which makes it painful to use.
First of all, when I build my project with Gradle from the command line, I don't have any issue, so it seems to really be a problem with Intellij (I am using latest community edition version, 2020.2.3) .
My first issue was that Mockito was not found at all : thinking that the lib was maybe corrupted somehow, I deleted it from gradle cache folder, where it was stored, so that it would get downloaded again.
Now it seems a little bit better : Mockito is found. However, Intellij will not find the thenReturn method on Mockito.when :
When I try to see Mockito's source code, I get this library source code does not match the bytecode, so maybe there's some inconsistency somewhere.. :
I cleared Intellij cache and restarted, but I still have the same issue. I have tried to clone and build the project in another directory (ie another Intellij project), but I have the exact same issue.
I am using Gradle 6.5.
Mockito version that comes is the 3.3.3, through spring-boot-starter-test (I am using the 2.3.5.RELEASE).
If I override this by declaring myself Mockito, in version 3.2.0 for example, then I dont have the problem anymore.
If I upgrade to Spring Boot 2.4.0, then Mockito 3.6.0 comes, and I don't have the problem..
so it seems to really be related to the Mockito 3.3.3 version I am using..
Is there something more I could do ?
I ended up downloading manually the jar from https://repo1.maven.org/maven2/org/mockito/mockito-core/3.3.3/ and replaced the jar that was used by my project in .gradle\caches\modules-2\files-2.1\org.mockito\mockito-core\3.3.3\ , and it seems to be working.
I will do more tests to understand where the corrupted version got download from.
I have used IDEA for some time and recently I updated to version 2018.1.1 from 2016.3. So it seems as if IDEA have gotten smarter, but not to my pleasure I am afraid.
So basically I have started to run into a lot of troubles lately. I have for example noted that when there are possible issues with the unit tests (eg. TestNG tests) there are currently two things that happens
1) Maven cannot find the jar (which btw builds perfectly from command line using mvn clean install)
2) Maven reverts to the latest working jar.
If I then try to reimport, I will go directly to (2). I also get weird error where commercial libraries such as guava generates errors.
I have never seen this until I upgraded IDEA Intellij. Anyone that have an suggestion on that might cause this and how to solve the problem.
The behavior I want is that the version marked out in the pom is imported with all the possible flaws, like it use to do. Then I can find the errors and fix them. I should also point out that, mvn clean install -Dmaven.test.skip works perfectly from command line, so not dependency issues with production code.
maven 3.3.9
jdk 1.8_172-b11
EDIT
I must mention that I use the "import maven projects automatically" feature here, which might explain (2), but I can still not see how this issue appears in the first place. Apart from changing IDEA version previously I have not had any problems in finding SNAPSHOTs.
EDIT 2
So the problem was indeed a pom error. I am not sure how eclipse managed to find the "correct" file (which was btw, not the correct file). After updating the pom it all worked out. I will not mention this here, since the behavior was a bit obscure (and I am not sure I understand it really). It have something to do with versions of the libraries, dependencyManagment, submodules and dependencies from submodules.
BR
Patrik
I am attempting to play around with Gradle integration in IntelliJ Idea (Ultimate) v12.
It seems even if $GRADLE_HOME is configured properly, basic syntax such as 'apply', 'dependencies', etc. is not recognized.
I would seem like the solution should be something simple. Any help is appreciated.
IntelliJ IDEA doesn't currently offer syntax completion for Gradle build scripts. All you get is the standard Groovy support.
I was having the same problem until this morning. I did the following steps and it solved itself:
added the root build.gradle file (we have several) to the JetGradle tab and refreshed
updated to IDEA 12.0.1 (it restarts and reindexes)
I think doing the first one and restarting may be enough, but I'm not sure.
I'm using Intellij 13 and have had similar problems. What I noticed was, creating a new Project from Intellij (i.e. new Groovy Project or Gradle project), I get the syntax error markers. I also have noticed it didn't do a good job pulling in Gradle dependencies.
On the other hand, if I Import a Project through an already created build.gradle file, the syntax error markings go away and the dependencies seem to play more nicely. Not sure if this works for you.
With Intellij 14 and Gradle 2.3 I found that adding {$GRADLE_HOME}/lib and {$GRADLE_HOME}/lib/plugins as libraries in my project settings got rid of all the warnings like "dependencies cannot be applied to groovy.lang.Closure".
I recently updated my sbt setup to version 0.11. As you may know, new SBT uses .ivy2 folder to store/cache all the retrieved jar files. I am using IntelliJ and I would like to know what is the recommended way of importing dependencies to the editor's classpath.
One option is to manually visit .ivy2 folder and select the dependencies. Is there a better/easier way to doing this?
I presume you use the SBT-plugin. According to the instructions on the linked page:
After each change to your dependencies, run gen-idea in the SBT Console. When prompted, reload the project.
I usually run
gen-idea no-classifiers no-sbt-classifiers
(see under "Usage" on github). IntelliJ (11 RC) will then ask you to reload the project, which is usually quite fast. Then the references to your SBT dependencies will be available.
You can try IvyIDEA plug-in.