Reputation: 130
Ok, I am completely new to IntelliJ (IntelliJ IDEA 2020.2.3, to be exact), so this is probably a noob question:
I want to create a folder structure, where I have the source code in src/main and the tests in src/test
However, I can't create directories underneath src. Every tutorial tells me to just create a "main" folder under src, but the option to create a directory doesn't show up when I use the "New" menu or Alt+Insert. I can create a package under src, but that is not what I want. I want sources and tests to be in the same package. And I see a lot of screenshots where people have somehow magically created "main" and "test" folders (not packages) under "src", but I can't figure out how.
Or is what I am trying to do either stupid or impossible, or both?
Any help would be greatly appreciated.
Upvotes: 0
Views: 2921
Reputation: 97148
You don't see the option to create a directory because "src" is already marked as a source root. You need to unmark it (right-click the directory in project view, select "Mark directory as > Unmark as source root"). After that, you'll be able to create the src and test directories and mark them as source and test source roots respectively.
Upvotes: 2