spring boot – Java file outside of source root intelliJ

spring boot – Java file outside of source root intelliJ

If you do an import from git, IntelliJ doesnt import the project structure from maven (or gradle) automatically.

One way to do this afterwards is to right-click on the pom.xml file in the root directory, and select Add as maven project. Then the folders will be marked correctly, and dependent libraries will be imported. There should be no need to mark individual source folders manually.

I prefer to do a git clone outside of IntelliJ, and open the project from the local filesystem, then IntelliJ imports the maven project structure automatically.

Very simple solution :-

Click on maven on the right toolbar in IntelliJ and then click on the refresh button.

spring boot – Java file outside of source root intelliJ

This has been driving me quite mad and I am a newbie as well. I finally solved it by using:

file > project structure >

Then going to Modules and removing all the files from the root using the x marks on the far right. I then used the +Add Content Root to reselect the src folders that contained my .java and hit Apply. Finally InteliJ sees the files as in the project and the folders gain the blue square on the main view.

Leave a Reply

Your email address will not be published.