Intellij is erroring when reading my build.gradle.kts file - kotlin

The red notification bar at the top says: /org/gradle/tooling/BuildException (java.lang.NoClassDefFoundError: /org/gradle/tooling/BuildException. I can run a gradle refresh successfully, I can run the project successfully, but I cannot get that error to go away. I think my project is actually running fine, intellij just can't properly interpret the build.gradle.kts file for whatever reason. Does anybody know what to do? I included an image. Clicking on the red bar does nothing. I can find no more information about the error message anywhere. I'm running the latest intellij EDU.

Deleting the entire .idea as suggested Luxus would work, but would also be a little bit too extreme.
The problem comes from a misconfigured .idea/workspace.xml, try to find your the part which look like this in the workspace.xml file :
<component name="StandaloneScriptsStorage">
<option name="files">
<set>
<option value="$PROJECT_DIR$/your_module/build.gradle.kts" />
</set>
</option>
</component>
You'll have to delete the whole <component/> tag, and maybe restart your idea to get rid of the issue.

just delete .idea folder and restart IntelliJ.

Looks like https://youtrack.jetbrains.com/issue/KTIJ-20903. Try to update your gradle version.

Related

Getting rid of "Cannot resolve file 'client'"-warning in env.d.ts in IntelliJ?

I built a Vue3 template project with Vite and TypeScript and am trying to get rid of all warnings in IntelliJ IDEA 2022.2.2 (Ultimate Edition).
This is a warning I'm getting, that I don't know how to get rid off:
I tried to delete the line, but then the build process fails.
Thanks to an answer I found out that the file in question does exist here:
but my IntelliJ seems to be too stupid to understand it, because of the missing .d.ts.
When I change it to the full file name, the warning is gone - IntelliJ finds the file:
But then the build process fails again, just like if the line were gone.
I tried re-indexing everything, invalidating all caches, I created a completely new project from scratch, but nothing worked - the warning is still appearing.
It's correctly resolved to node_modules/vite/client.d.ts:
Make sure that you didn't exclude node_modules folder from indexing

Intellij is not showing "External Libraries" in Project Tab

There is nothing on left. It is a maven project. Why?
I've had the same problem and narrowed it down to the following configuration that might have been messed up during the upgrade.
File (on Mac): ~/Library/Preferences/IntelliJIdea2018.1/options/projectView.xml
<application>
<component name="ProjectViewSharedSettings">
<option name="showLibraryContents" value="false" />
<option name="showMembers" value="true" />
</component>
</application>
Change/remove the showLibraryContents entry. This setting is no longer available in the UI, "External Libraries" are always shown.
I solved this by selecting "Project" as view (by default i had "Project Files"). Hope this helped.
Project View VS. Project Files view
I was facing the same issue on windows, i solved it by
right click on pom.xml > maven > reimport
Then reopen the project, It worked for me.
Hmmm, it seems I have seen this same kind of thing recently. Check your module settings (right click on highest level folder - open module settings, or Command-;). Make sure you have one module if it is a single-POM project, and check the sources, paths, dependencies tabs and make sure they look right. I think I've seen this once when I created a module manually rather than letting intellij create one for the Maven module automatically.
That "recycle/refresh" icon on the far right pane you show - the Maven project pane - can also sometimes get it to fix things it didn't get right when you initially check out project.
If maven re-import does nothing, check your pom.xml for errors and try commenting out the offending ones (marked in red).
In Intellij: Ctrl + Alt + Shift + S -> Select Modules and ensure that there is only one module. Delete the other ones.
If all else fails:
In Intellij, Select "Invalidate caches/Restart" -> Close Intellij -> Go to the project folder and delete .idea folder -> Reopen Intellij and "mvn clean install"
Deleting ./idea directory and re-importing the project worked for it.

IntelliJ + Play Framework routes file red underline error

Image of the errors
I don't how to fix this red underlines I recently got in my routes files.
What I did:
I split up my routes files into 3 files:
- routes
- rest.routes
- web.routes
And after I did, IntelliJ said something about "We have a new program that can handle .routes files" and I clicked yes to it. <-- Stupid me :(
Can also mention that I cant remember what addon that was installed, and I cant find any addons that differs from previous versions.
Before there was no "spellchecking" on the file, but now I get this box in top of the file saying "Project SDK is not defined 'Setup SDK' ". It also gives the red "undelining" similar to spellchecking under every single line of code in the file.
The code itself works great, its just very frustrating to have these red lines everywhere.
Anyone know how to get rid of it?
Highly appreciated!
IntelliJ 2017.2 and Play Framework 1, I had this problem one day. Took me awhile to figure out but it was the Scala plugin that made this fail for me. After uninstalling the Scala plugin it works again.
I also faced similar issue recently. The plugin that Intellij asks to install in this case is Erlang. You just have to uninstall it (or just suppress the warning).
To uninstall Erlang go to Preferences.. -> Plugins. Then search for Erlang and select. Then click uninstall (on the right pane).
First, setup Java SDK (even if you use scala)
Second, try to compile code (run play application) and recheck routes files. I suggest that IDEA use compile routes classes to verify config.
Third, check syntax of your conf/routes . Are you sure want use -> ?

Idea highlighting tags in build.xml as not allowed

My IDE (Idea) says: Element 'property' not allowed here.
And some other elements not allowed too.
But project building successfully.
How can i fix this?
It looks like IDEA is not recognizing the file as an Ant build file. The fact that the <project> tag is in red indicates that is, pardon the pun, the root of the problem. Try the following:
Got to File > Invalidate Caches / Restart (or Application > Invalidate Caches / Restart on Mac)
Click the Invalidate and Restart button on the "Invalidate Caches" dialog
Let IDEA restart and then re-index the project.
Another thing to check, although a long shot, is that the Ant Support plugin is enabled in File > Settings > Plugins.
If that does not solve the issue, can you please put your cursor on the <project> element and indicate what the error is for that element.
I have discovered that xml prefix needed to be added to Ant files for IntelliJ to being to recogize them as such. Add this as the first line and most of the red is gone:
<?xml version="1.0"?>

IntelliJ IDEA "cannot resolve symbol" and "cannot resolve method"

What are common causes for IntelliJ IDEA not being able to resolve built-in JVM types and methods? For example, when I mouse over String the tooltip says "Cannot resolve symbol 'String'". It's as if IntelliJ has doesn't know where the JVM is.
By the way, I am running OS X 10.6.6. Everything was working fine until I ran the system update this morning.
Most likely JDK configuration is not valid, try to remove and add the JDK again as I've described in the related question here.
First check if you have configured JDK correctly:
Go to File->Project Structure -> SDKs
your JDK home path should be something like this:
/Library/Java/JavaVirtualMachine/jdk.1.7.0_79.jdk/Contents/Home
Hit Apply and then OK
Secondly check if you have provided in path in Library's section
Go to File->Project Structure -> Libraries
Hit the + button
Add the path to your src folder
Hit Apply and then OK
This should fix the problem
I was facing the same problem when import projects into IntelliJ.
for in my case first, check SDK details and check you have configured JDK correctly or not.
Go to File-> Project Structure-> platform Settings-> SDKs
Check your JDK is correct or not.
Next, I Removed project from IntelliJ and delete all IntelliJ and IDE related files and folder from the project folder (.idea, .settings, .classpath, dependency-reduced-pom). Also, delete the target folder and re-import the project.
The above solution worked in my case.
For me, I had to remove the intellij internal sdk and started to use my local sdk. When I started to use the internal, the error was gone.
I tried almost everything but nothing was helping with the ibm jdk 1.8. to fix this issue. then I found an article from https://youtrack.jetbrains.com/issue/IDEA-279214/Cannot-resolve-symbol-String-when-using-IBM-JDK-180 and it worked like charm!!!
so sharing original help credit goes to #Serge Barano. incase anybody needs and not able to able to resolve the issue using previous solutions like me.
according to the article answer is:
IBM JDK has a weird layout and the jar with the String class is in bin directory for some reason:
d:\dev\ibm_sdk80\jre\bin\default\jclSC180\vm.jar
If you add it to the JDK classpath in IntelliJ IDEA, the issue should resolve:
For me, IntelliJ could autocomplete packages, but never seemed to admit there were actual classes at any level of the hierarchy. Neither re-choosing the SDK nor re-creating the project seemed to fix it.
What did fix it was to delete the per-user IDEA directory ( in my case ~/.IntelliJIdea2017.1/) which meant losing all my other customizations... But at least it made the issue go away.
First of all you should try File | Invalidate Caches and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
For me ,
File -> project structure -> Project Language Level (11) selection worked. Local variable syntax for lambda paramters.
In my case, cloning repo from the remote was the easiest way to solve this issue.