Home  >  Article  >  Java  >  How to solve the problem of importing springboot project from idea without maven

How to solve the problem of importing springboot project from idea without maven

PHPz
PHPzforward
2023-05-14 23:58:116037browse

Idea imports the springboot project without maven

There is a pom file in the project but there is no maven

This is because the project fails to identify the pom file, and we need to manually add the main pom file of maven.

Solution

Double-click the shift button in the project, enter the file search function, and then search for maven.

How to solve the problem of importing springboot project from idea without maven

Then click Add Maven Project to add the maven main configuration file, and then wait for compilation.

How to solve the problem of importing springboot project from idea without maven

Problems when idea imports springboot project

The Springboot project obviously has a jar package compiled but reports that the package does not exist

Background description:

I newly installed idea and imported the springboot project in gittee. Everything was normal on the old computer, but there was a strange problem when installing idea on the new computer. , let’s talk about the solution to the problem.

Environment:

  • ##windows11

  • jdk1.8

  • maven 3.2.3

  • idea 2020.1.1

Problem description

1.Springboot project The jar package obviously exists, but the project is not reported as red. You can find the jar package by clicking in it, but when compiling, a lot of errors will be reported, saying that the package does not exist, and there are a lot of errors that the compiled package does not exist.

2. The springboot project is stuck at startup

Solution

Solution to the first problem:

Found this problem My first reaction was to clean the project and re-direct the package. Since it was a new computer, I deleted all the packages in the maven warehouse and downloaded them again. Then File -invalidate cache/restart still reports errors. Later, I searched for solutions on Baidu. Mainly listed below two types.

1) Set in File-settings-maven-importing

How to solve the problem of importing springboot project from idea without maven

2) In File-settings-compiler-Annotaion Processors before Enable annotation processing Beat√.

Let me talk about the results of my attempts, and found that they were useless, because the version of idea I installed was this by default. Finally, I found an answer saying that there might be a problem with the cracked version of idea, because I directly dragged it from the zip package. When I imported the cracked package, an error popped up, but I didn't pay attention. I was wondering if it was indeed the problem, so I uninstalled the idea and reinstalled it, clicked on trial, dragged in the project, re-imported the package, and the project started successfully. So if you really can’t solve it, just reinstall idea. Then honestly unzip the zip and drag the cracked package.

Solution to the second problem

After the reinstallation is completed, start the project. The result log shows that after loading the xml file, it is stuck. Stop the project. , clean the project, maven reimport, and it succeeds.

The above is the detailed content of How to solve the problem of importing springboot project from idea without maven. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete