Grails 3 project getting 'Cannot resolve symbol in IntelliJ IDEA' for various files - gradle

I am using Grails 3.3.8 with IntelliJ IDEA Ultimate 2018.1, but the view editor doesn't show it correctly for some reason even though I have all the configuration and dependencies. The same error/warning comes in gsp's as well. Also I am using the shiro-plugin and get the error's for its tags saying that it's not allowed.
No issue is faced while running the app but not sure why the code is not detected by IntelliJ correctly. I also tried Refresh All Gradle projects many times and even did a grails clean and build but they still show.
Note: I have the same project running on Grails 2.5.6 and it detects all fine in the same IDE version. This is when I upgraded the project to 3.3.8.

Related

Intellij complaining about JDK location

First Image
Second Image
As I attached 2 images, I am having trouble running my spring boot gradle project written in groovy.
As soon as I open the project, intellij tries to build the project and it fails saying Gradle Sync failed.
Since it is complaining about java home in the jdk setting, I was trying to change the path as my intellij expects. but as soon as I change it, it tells me that it cannot find android sdk location. and I have no idea why it cares about android sdk. This project is about spring batch job using gradle and groovy.
I have been searching why it happens for days now and online is talking about ardroid studio solution. and those solution do not apply to my problem.
Can someone help me with this issue please?
Thank you in advance.
It looks like you are running Android Studio instead of IntelliJ IDEA.
The former doesn't support projects other than targeted for Android, so your project will not work there.
Make sure you run IntelliJ IDEA. You can get it at https://www.jetbrains.com/idea/download/index.html.

spring initializr: Cannot import org.slf4j.LoggerFactory for Gradle projects

I'm trying to learn how to build "Spring Web" web-applications using IntelliJ IDEA, and I'm encountering a very frustrating issue when I try to create a new project using "Spring Initializr".
For some reason when I choose to create a "Gradle Project", Java or Kotlin, I'm not able to import org.slf4j.LoggerFactory
If I manually add the import statement, it doesn't resolve, and if I try to get InteliJ to automatically add the import, it instead adds the following...
import com.sun.org.slf4j.internal.LoggerFactory
This satisfies the editor, but it won't compile. It errors with...
Symbol is declared in module 'java.xml.crypto' which does not export package 'com.sun.org.slf4j.internal'
If instead I create a "Maven Project", either Kotlin or Java, then it works as expected.
I'm keeping the other settings in spring initializr set to default values, Spring Boot=2.4.2, Java=11
IntelliJ IDEA says there are no updates available.
I've made various attempts to manual add the slf4j dependencies to build.gradle (for Java) or build.gradle.kts (for Kotlin), and nothing I've done has made any difference.
I've also tried various different options for Spring Boot and Java version, and again it has made no difference.
Update...
I've confirmed that it only happens on one of my computers, my primary development desktop computer. My laptop is working fine.
I can't find anything that's different between the 2 IDEA installations.
Things I've tried so far to fix it...
Invalidate Caches / Restart
Manage IDE Settings -> Restore Default Settings
Removing and re-adding JDK's
Uninstalling and re-installing IntelliJ IDEA
I've tried everything I can think of to fix this, but the problem persists.
Basically I can't use logging in any new Gradle Spring projects. It just won't load the org.slf4j library.
Update 2...
The nature of the problem isn't exactly what I thought it was initially. It turns out the code compiles and runs just fine with the correct import, but the IDE is reporting it as unresolved.
So it seems it's just an issue with the IDE's intellisense. This seems less serious, but it's still quite inconvenient having the editor incorrectly showing errors.
After identifying that the problem was just with the IDE editor intellisense, rather than with the code dependencies or project, I was eventually able to resolve it by closing the IDE, and then deleting the system folder "C:\Users<user>\AppData\Local\JetBrains\IntelliJIdea2020.3"
After restarting IntelliJ IDEA, the folder was re-created automatically and the issue resolved itself.

Intellij cannot resolve variables of thymeleaf templates in spring boot

This thread said the problem is fixed already, but it seems that I still have the problem even I have the latest version of IntelliJ Ultimate.
I have implementation "org.springframework.boot:spring-boot-starter-thymeleaf" in my gradle setting.
The application works fine, but I want to be able to use The Navigate to Declaration feature provided by IntelliJ. I already have thymeleaf-spring module in my project.

How to fix gradle eclipse plugin to use correct JRE when importing gradle project?

Currently, I can run ./gradlew eclipse and create the eclipse project and that works great in that it uses JavaSE-1.8. Unfortunately, I have 12 projects and don't really feel like loading each one at a time.
The issue though is when I use the gradle eclipse plugin and import the project, it decides to use JavaSE-1.7 which I did 'used' to use. I can't seem to find a quick setting in the gradle plugin, though it would be even nicer if I could just put the info in the build.gradle file for everyone to use.
The following code blew up in my face when I imported the project..
https://issues.gradle.org/browse/GRADLE-3100
Well, the .remove method blew up. Removing that resulted in ending up in 1.7 even though I put 1.8.
I am using gradle-2.11-bin.zip
UPDATE: I removed the '' replacing with single ' so that it doesn't throw an exception but still loads 1.7. To work around this issue, I load with gradle plugin and then run ./gradlew eclipse and then collapse all projects and using the shift key, I then select all projects and refresh and it moves to 1.8 (so the gradlew eclipse works while the gradle plugin doesn't :( they must be different code path).

Springsourcetoolsuite sample project throwing maven dependency issues

I am new to STS and installed the latest version yesterday. Once installed I went to New->Spring Template Project->Simple Spring Batch Project and followed the instructions like giving a project name, specifying a package name and clicked finish.
The project is showing a lot of errors. I tried updating maven dependencies and clicked almost all logical options in maven. I even see that org.springframework is not resolved. I see "Failed to read artificat descriptor errors".
Can anybody guide me here? Since this is a sample project I expected it to compile and run straight away. Am i missing something?
My STS version is 2.7.2 and maven is 4.0
Unfortunately, some of the template projects are a bit out of date. I'd recommend posting on the STS forum for a bit of help on getting them working.
http://forum.springsource.org/forumdisplay.php?32-SpringSource-Tool-Suite

Resources