VS Code - Import and Run Spring Boot Project - spring-boot

I am trying to import and Run a Spring Boot Project which is working in STS under VS Code.
But I am facing the following error:
org.eclipse.core.runtime.CoreException: The project: ckac which is referenced by the classpath, does not exist.
Here is the screenshot of the Project Structure.
On my local machine, my project is under senp_kyc.
I used the option File -> Open Folder and selected the folder under which my Spring Boot Application code is present.
It will be great if someone could guide me for the same.

Related

Spring boot application not detected by Intellij

Intellij is not detecting spring boot application created in a different IDE.
The application in discussion is the one starting with the letter "e"
How can i fix this ? I am using intellij community edition.
As mentioned in the comment, there is no standard spring boot application in IntelliJ.
In the screenshot provided in the question, there is no pom.xml file. If you have that in the project then right-click on it -> Maven -> Add as a maven project.
If this doesn't work, read this https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000023059-IntelliJ-does-not-recognize-workspace-maven-modules for more analysis ways.

Spring Boot application is not running in STS with profiles due to Run Configuration is not showing Project names in Drop Down to be selected

Need some help in running Spring Boot Application, I have cloned a Microservice and Imported into Eclipse. Now I want to run this as spring boot application in my STS(4.10.0 version). While running I need to supply profile. For this I am setting up configuration (Run Configuration).
Steps :
Right click on Project
Select Run As > Run Configurations
Select "Spring Boot App" -> Click to Add new Configurations
Here I am unable to select Project, it is not displayed in drop down. Below is screenshot
Note : I tried Importing Project as "Maven Project", "Existing project Into Workspace" and Git project into workspace. All these 3 ways are not working for me
Need help
This looks like your project is not recognized as a Spring Boot application. Without looking at your project it is hard to say why the IDE doesn't identify your project as a Spring Boot project. Does that work when you create a new Spring Boot project using the Spring wizards? Also feel free to share a link to your project, we would be happy to take a deeper look.
As a workaround, you can always start your Spring Boot application as a regular Java Application using the "Run as Java Application" in the IDE. That way you would have to set the active profiles via a system property in your launch config.
Oddly, I had this issue for a spring boot maven project and it was pom.xml being malformed even with no warning or error. Took me days, I had imported/re-imported/messed with the java build path/compiler and installed jres. I was unable to download maven dependencies. I took a look in the dependencies section of the pom.xml and noticed lifecycle-mappings issue. Once I took out the 3 lines of incorrect xml syntax in the pom.xml I was able to download the maven dependencies and then the project appeared as a spring boot project in run configs.

Run as Spring Boot option not appearing in STS

I imported a Working Spring Boot Maven Module Application into STS and the "Run as Spring Boot" option is not appearing. I did a Maven Update, Clean and Install. When the Install runs it completes some simple JUNIT tests. I'm sure its just a config problem somewhere. I know this isn't a lot to go on.
Ensure you are looking for Run As -> Spring Boot App while right-clicking on the Boot project in the Package Explorer or Project Explorer.
If the action isn't there open Launch Config wizard (Run As -> Run Configurations...). Check if "Spring Boot App" category is in the list on the left.

Spring STS not recognizing project structure with Gradle

I'm trying to do this getting started guide from Spring. So I cloned the project using git from the command line. As I'm working with Gradle, I removed the Maven files from the repository to clean the project.
After that I open my STS and go to File -> Open Projects from File System and navigate to the /initial folder of the repository. The project is imported correctly but when I try to add some "java stuff" (packages, classes, etc.) I get several errors and I can only add folders and files, which is quite annoying for working.
To be more descriptive, I'll add some images so you can see what's happening. This is the project initially imported into STS as I described above:
Then I try to add some java stuff, let's say for example a source folder. So Right Click on library -> New -> Source folder and this is the result:
And in the properties of library I have the following:
So the question is: how can I tell to STS to recognize the library folder as a Java Project (or Gradle module, I don't know how to call it) instead of a plain folder so I can add my packages and classes?
Thanks in advance for your answers.
In case you would like to work with Gradle, you should use the Gradle integration for Eclipse (project Buildship) and install that into your STS environment. After that, you should be able to import the projects either from disc as existing Gradle project (not as file system) or via the wizard that integrates the spring guides into STS (Import Getting Started Content). The wizard for the guides also let you choose between the Maven and the Gradle variant, so you don't need to close and delete stuff yourself.
Hope this helps!!!

Reference External Project in Spring Configuration

I am trying to reference a project in my main project. I am a .NET developer so I am having a hard time knowing the correct way to reference it. I have a data project and a data project in a MAVEN multiple project setup. In the screenshot you can see I am trying to reference a DAO object from my data project in the security.xml file in my Spring MVC web project. When I run the project it says it can not find the correct class.
Actually I fixed this by adding a Maven dependency of my project, which created a JAR for Tomcat, and fixed the issue. I didn't know you could search the Maven Local Repository to use your own projects.

Resources