Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate Spring with IntelliJ

I have downloaded the Spring toolsuite, and installed. Now when I try to create a new project in IntelliJ it doesn't show Spring in Libraries.. How can I get Spring in there?

Thanks in advance!

like image 345
Davey Avatar asked Aug 29 '12 14:08

Davey


2 Answers

I am answering this question so late, but I need to contribute to the answer in order to clarify things so it may help others in future.

There is something you need to know clearly, there are two different types of IntelliJ IDEA, the first one is INTELLIJ IDEA ULTIMATE which is a comercial product, it means it is not free, and there is INTELLIJ IDEA COMMUNITY, which is free.

The first one (IntelliJ IDEA ULTIMATE) support everything regarding java and kotlin plus other languages, with that you can create any type of project in java, it doesn't matter if it is a desktop application, mobile app or web app with java2ee platform. But the second one (IntelliJ IDEA COMMUNITY) it has limitations. You can create different types of projects of your choice but you cannot go with java2ee project if you are not creating it with maven or gradle.

So, if you want to create SpringBoot application, it may be possible with IntelliJ IDEA Community. You don't need to download Spring Tool Suite for that. There are 2 or three possibilities.

  1. You need to go to create project, then you choose maven, then you set everything, then after the project has been created, you open the xml file called pom, you add dependencies which will tell maven to download all needed libraries for SpringBoot application. And you start your coding. But this first step, is not the best choice, because once you created project in this way, there are other maven-plugins that you will miss in your project, so it will be a big problem when it comes to deployment.

  2. The second way which is the best is to go to https://start.spring.io/ then you create springboot project there, then you download it, it will be a .zip file, you unzip in, then you import it in IntelliJ IDEA. There you will get everything needed to work with.

like image 161
Mugirase Emmanuel Avatar answered Sep 18 '22 16:09

Mugirase Emmanuel


Intellij Community edition does not support Springboot projects. It is available only in Ultimate edition. This is the reason I switched back to Eclipse (or STS).

There are few workarounds that will help you to run Springboot projects in Intellij Community edition:-

  • By running Main class .
  • By executing spring-boot:run command in terminal or cmd.
  • You may need to change some settings to make spring-dev-tools work in Intellij Community edition.

My recommendation: If you are planning to use spring and spring-dev-tools then you should either switch to Intellij Ultimate edition or Eclipse STS.

Reference: https://www.jetbrains.com/idea/download/#section=windows

like image 43
ABD Avatar answered Sep 16 '22 16:09

ABD