Mateus Viccari
Mateus Viccari

Reputation: 7709

How to create "java" folder into a maven webapp project in Intellij?

I tried to create a maven webapp project in Intellij, it creates the maven folder structure like this:

-src
---main
------resources
------webapp

But it does not create the "java" folder. If i try to create it manually, when i right click the Java folder it does not give me the option "new Class" or "new package", just "new file" or "new folder".

How to make the IDE understand the folder as a java folder?

Upvotes: 19

Views: 10129

Answers (2)

deathangel908
deathangel908

Reputation: 9709

If it didn't create java directory, perhaps you didn't chose to create a java maven application when you opened/imported directory with project to idea. Anyways maven's structure is determined and java sources should be in java folder. You have to create a folder manually and mark it as java sources. Go to project settings(alt+ctrl+shift+s) -> Modules -> check your module in sources find your folder and Mark as Sources

mark as sources

Upvotes: 2

vikingsteve
vikingsteve

Reputation: 40438

You need to right click the java folder and choose the option:

Mark Directory As -> Source Root

Upvotes: 42

Related Questions