Skip to content
Advertisement

Java file outside of source root intelliJ

I have cloned a spring boot project from GitLab having multiple branches in IntelliJ. I checkout to the branch in which I want to work. But I am getting “Java file outside of source root” on all the files. Please suggest what I am doing wrong. I just installed IntelliJ and it’s the first project that I am importing.

Advertisement

Answer

If you do an ‘import from git’, IntelliJ doesn’t 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 afterwards open the project in IntelliJ from the local filesystem, then IntelliJ imports the maven project structure automatically.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement