0

I am doing this tutorial, which asks me to create multiple source directories in eclipse. Can someone explain how to do that? I am describing the steps I have taken so far as follows:

The image below shows the tutorial's directory structure on left, and my current directory structure on right:

As you can see, I need to create the following folders under Java Resources:

src/test/java  
src/test/resources  
src/main/resources  

However, when I right click on the Java Resources folder and select new source folder, I get the following dialog box, for which I have clicked on the Browse... Folder Name button to open the subdialog which is also shown:

At this point, none of the choices seem to be what I want. So how do I create the three new src subdirectories that are specified by the tutorial?

2 Answers 2

3

Right-click your project, select Build Path and Configure Build Path.... In the Source tab, if src/main/resources or src/test/java appear, remove them. This might be a bug with the Maven plugin, I don't know. They appear like they are there, but aren't really.

Then use Add Folder... to add the folders you need. Do this by selecting a folder (to add folders to), like src/main, clicking Create New Folder... and using the folder name resources (or as appropriate).

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. That works. Do you have any comments about the inclusion criteria and exclusion criteria for which it prompts you?
@Code You can put some patterns for what files/folders in that src folder should be added or excluded from the final build.
0

You close the "Existing Folder Selection" dialog (since you don't want an existing folder, but a new one), and you enter src/test/java in "Folder Name". Then you click Finish. You repeat this operation for every new folder you want.

Of course, you could also use your file manager to create the folders, and select them in Eclipse.

1 Comment

Thank you. But I tried that and eclipse tells me the folder is already a source folder. If you look at the print screen I put at the top of my posting, you will see that Java Resources and src are each root folders in the eclipse project. Your method tries to put it in the src folder, but I need to create something under the Java Resources header, like in the print screen above. Do you have another suggestion?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.