Intellij complaining about JDK location - gradle

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.

Related

IntelliJ IDEA on Mac. Is it possible to build my Kotlin Native project from the commandline without the IDE?

Quite new to all things Kotlin / IntelliJ / IDEA / gradle.
I'm comparing some code in about ten languages and the Kotlin Native version is the only one that I can't figure out how to build without using the IDE.
I started the project in IntelliJ IDEA by following guides on getting started with Kotlin and this was the recommended method.
By Googling, searching the IntelliJ help, and hunting here on StackOverflow I've been unable to find the answer. Most questions are about Multiplatform and phone apps. I'm just making a macOS commandline tool for now.
Is there a way included with IntelliJ IDEA to build a project form the terminal without starting up the IDE?
Or would it actually require me to use a completely different build system and just use Kotlin Native Mono install totally separate from the IntelliJ setup? Is no shared build system possible or would that be an even more advanced proposition?
There is no need to use the IntelliJ IDEA to build the Kotlin native project.
You should be able to use the gradle build or gradle nativeBinaries command from the Terminal to build the Gradle project.
Also, you could refer to the Kotlin native documentation here for details: https://kotlinlang.org/docs/native-gradle.html
I figured it out with a bit more trial and error.
IntelliJ IDEA seems to come with gradle but doesn't put it in the path. The IntelliJ IDEA project has set up a build system that will work with gradle as is though. You don't have to set up a new one from scratch.
In my case the gradle executable was at:
/System/Volumes/Data/Users/hippietrail/.gradle/wrapper/dists/gradle-7.4.2-bin/48ivgl02cpt2ed3fh9dbalvx8/gradle-7.4.2/bin/gradle
Running gradle using the full path with no parameters looks like it's doing something and takes a while, but doesn't build the project. To build it simply add the build parameter so in my case:
/System/Volumes/Data/Users/hippietrail/.gradle/wrapper/dists/gradle-7.4.2-bin/48ivgl02cpt2ed3fh9dbalvx8/gradle-7.4.2/bin/gradle build
It seems that gradle is not in the path by design and that the intended usage is via the gradlew that IntelliJ IDEA put in my project directory for me. This is an (explicit) wrapper script for gradle. So the more straightforward invocation is:
./gradlew build

Intellij gradle import Issue

I'm having a lot of issues w/ my intellij project to recognize 3rd party libraries I've imported with gradle. Let me outline some steps I've tried.
The code compiles properly in the terminal.
Invalidating and restarting intellij does nothing.
The import, seems to be in the project dependency folder.
I've tried removing the import and resyncing gradle, then adding it back in.
Tried deleting the intellij app and re-installing (I think I may have done this wrong given my configurations were saved upon re-download).
I've tried unticking offline mode, and doing all this in gradlew preferences.
I've tried increasing memory allocation in both intellij and for gradle.
No one else on my team seems to be having this issue.
I have no idea what else to try or where to look. Would LOVE some pointers. Happy to edit. Thanks!
Intellij Version: 2019.1.3

IntelliJ SpringBoot dependency problems

I'm trying to follow several tutorials on how to use Spring Boot, however I keep running into issues where none of my dependencies are working properly. Below is an image displaying my problem.
I've tried making sure that I installed Maven correctly, however I imagine there is something that I'm doing wrong. I think that I have Maven in the proper Paths but, but I can't tell why it would still be providing the errors that it does. I've followed what it stated to do for Windows users, and have as follows.
Whenever I run mvn -version I am getting the following.
Can anyone help guide me in order to properly have Maven working on IntelliJ?
If you are using IntelliJ IDEA then I suggest using Spring Initializr which would create sample application with correctly configured maven setup is you choose Maven Project for Type:
http://blog.jetbrains.com/idea/2015/03/develop-spring-boot-applications-more-productively-with-intellij-idea-14-1/
Are you using Gradle or Maven to import required dependencies? If not, follow the guides here:
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/
If you have them setup, try to click one of the error and then click the red light bulb icon, see what it suggests you to do.

Gradle context sensitive support in STS/Eclipse

I am trying to evaluate Gradle as next-gen build tool for some of my future projects.
Steps I've done so far:
I have Java 7 installed on my machine.
Installed Gradle 2.0
Installed Spring Tool Suite 3.6.1, went to dashboard and added support for
Gradle and installed also Groovy-Eclipse package.
Now when I start Gradle projects from scratch or I clone some of the projects from github,
I am not able to get context sensitive help, like Ctrl + Space to autocomplete stuff in
build.gradle file.
I was reading a lot of documentation on net about this, and couldn't find proper answer, so if someone can give me some idea is it working?
Previously I was using Maven, and m2-eclipse, so when I type in pom.xml I am able to do Ctrl + Space which prevents me to make typo mistakes.
NOTE: Just please note that I've enabled Gradle DSL support for my Gradle projects.
Thank You
Gradle's build language is much more dynamic, extensible, and powerful than a Maven POM, and hence it's much harder to develop full IDE support for it. Recent versions of the Eclipse Gradle Plugin have limited editing support, and work is underway to take it to the next level. IntelliJ 14 is already further along, but expect to see further improvements there as well.

Intellij Debugging picking up old version project files

I am debugging code in Intellij. I use maven to build the project and there are various versions of the project sitting in the local .m2 repository. Intellij keeps on picking the old version of the code from the previous snapshot of the project when I start debugging. How do I make IntelliJ debug the latest code from the local repository?
You can tell Intellij 2016 to ask you each time which source code to step through.
File->Settings->Debugger
Show alternative source switcher
Try removing .jar and .war files that contain your code from your ~/.m2/repository/
For me the issue is that I built something and it is now registered in Maven under what Maven considers a newer version, but isn't what I was currently working on. I compiled, say, version "2.1" to debug something and then went back to working on "sand-box-idea-SNAPSHOT". I keep thinking why isn't Intellij picking up my latest sand box change but it's because it's deferring to the Maven version 2.1 which Maven assumes is better than 'sand-box-SNAPSHOT'.
It may be that you have some plug-ins interfering with IntelliJ's build process. I know that the Google Protocol Buffers Plugin can cause my Intellij to be unable to detect dirty classes that need to be re-compiled.
I've met similar behavior, maybe it can help you :-)
I developed app (using maven) and during the time I change output packaging from jar to war. Maven repository than contained both versions, jar and war, because maven does not remove old jar when you change it. As project pointed to mvn repository, it still used old reference to jar but new version within war was updated.
I was really upset as maven compilation and tests worked fine but Idea used me old version. I've had rebuild idea project and it worked later fine.
I have seen this very recently after upgrading from IDEA 13 to IDEA 14. It seems like launching configurations created in IDEA 13 are no longer automatically triggering a mvn package prior to launch.
In order to fix this I manually added a mvn goal in the "Before Launch" dialog.

Resources