Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ doesn't recognize java project after cloning

I've cloned my repo from bitbucket and I am trying to open it in IntelliJ IDE, but i can't set Debug Configuration, can't set Main class in Application menu. I can't also add new Java class into project. I think that Intellij can't recognize this project is Java.

Is it possible to make it right?

like image 847
michalleek Avatar asked May 06 '15 22:05

michalleek


People also ask

How do I install an existing Java project in IntelliJ?

Import a project to IntelliJ IDEA Launch IntelliJ IDEA. If the Welcome screen opens, click Open. Otherwise, from the main menu, select File | Open. In the dialog that opens, select the directory in which your sources, libraries, and other assets are located and click Open.

How do I import a project from one project to another in IntelliJ?

Launch IntelliJ IDEA. If the Welcome screen opens, press Ctrl+Shift+A , type project from existing sources , and click the Import project from existing sources action in the popup. Otherwise, from the main menu, select File | New | Project from Existing Sources.


4 Answers

You have to mark your src directory as Source Root.

Right-click on the src folder and select Sources Root:

enter image description here

Then you'll see that the icons will change:

enter image description here



EDIT

Check the output path by bringing up the Project Structure view.

Press Ctrl+Alt+Shift+S

enter image description here

like image 167
maba Avatar answered Oct 04 '22 11:10

maba


Similar to what maba said above, but if applicable you probably want to mark main and test as source & test source directories (respectively). That's a common project directory structure where literally marking src (parent of main and test) as source won't work for you.

like image 39
cognalog Avatar answered Oct 04 '22 12:10

cognalog


Yes, marking src folder as 'Source Root' resolved the issue. Earlier intellij was not detecting java files.

Go to: Right Click --> src --> (Choose option) Mark Directory as --> Source Root.

like image 39
Yusuf Saifee Avatar answered Oct 04 '22 13:10

Yusuf Saifee


As a footnote, I've had what I thought of as small projects take well over 15 minutes to fully load into IntelliJ, and during this time the little status bar in the bottom right seems to be downloading dependencies (lots of Spring stuff) ... though most of them should have already been in my local ~/.m2 maven repo.

Maybe slow network, maybe the repo/proxy I was hitting was slow ... whatever, I'm just reminding people to check that status bar when opening a new project.

like image 24
LarryW Avatar answered Oct 04 '22 11:10

LarryW