Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAli Baig
Courses Plus Student 120 PointsWhen I create directory tests and right click > select "Mark Directory as" I see only 1 option Excluded. Using latest IJ
I am unable to create centralize test directory. Right click is not showing me any other option other then Excluded. I am creating directory at top project level by right clicking and selection New > Directory. I am using Windows 10 and latest IJ.
3 Answers
Ido Shenhav
4,577 PointsOkay for those who have the same problem, I've figured it out in my case (partly due to the answer Fahad gave, so thank you Fahad!). So it turned out the 'java-unittesting-vendingmachine' folder was marked as Source Root.
All you have to do is unmark it and you can then mark 'src' as Sources Root and 'tests' as Test Sources Root
Fahad Mutair
10,359 Pointshi Ali Baig , if try to Mark Directory any folder inside resources folder or source folder like (src/main/java/any folder) it will show only Excluded.
Adam Fields
Full Stack JavaScript Techdegree Graduate 37,838 PointsHere's my directory structure (using the Maven style):
vending-machine <-- module (content root)
├── src
│ ├── main
│ │ └── java <-- sources root
│ │ └── io
│ │ └── github
│ │ └── adamelliotfields
│ │ └── Main.java
│ └── test
│ └── java <-- test sources root
│ └── io
│ └── github
│ └── adamelliotfields
│ └── MainTest.java
└── vending-machine.iml
When starting a project in IntelliJ, it creates the src
folder for you.
Go into terminal and generate the rest (assuming you are in the project root folder):
mkdir -p ./src/main/java/io/github/adamelliotfields
mkdir -p ./src/test/java/io/github/adamelliotfields
Then you can go into Project Structure and label your folders as you wish.
Finally, if you're using Maven or Gradle, it will generate all this automatically for you.
Ido Shenhav
4,577 PointsIdo Shenhav
4,577 PointsI'm having the same problem... It's not inside the src or resource directory... Using windows 10 and latest intelliJ