Creating a new source folder with exclusion filter
In a project that uses source folders, you can create a new folder to contain Java source code with exclusion patterns. Exclusion
patterns are useful if you have nested source folders. There are two ways to do it:
- You don't already have an existing Java project in which you want to create a source folder with exclusion pattern.
- You already have an existing Java project.
Starting from scratch
- First follow the steps of the task "Creating a new source folder".
- Once a first source folder is created, if you want to create another source folder that is nested inside the first one, you
need to use the exclusion pattern.
-
Open the Java Build Path page (Project > Properties > Java Build Path) and click the Source tab.
-
Click Add Folder, select an existing source folder, and click Create New Folder to create a folder that is nested inside the first one.
- You will get a dialog saying that exclusion filter has been added to the first source folder.
NOTE: The trailing '/' at the end of the exclusion pattern is required to exclude the children of this folder.
The exclusion pattern follows the ant exclusion pattern syntax.
-
Click OK and Finish when you are done.
From an existing Java Project
- Before you start, make sure that your project properties are enabled to handle exclusion filters in source folders.
-
In the Package Explorer, select the project where you want the new source folder to reside.
-
From the project's pop-up menu, select New > Source Folder. The New Source Folder wizard opens.
-
In the Project Name field, the name of the selected project appears. If you need to edit this field, you can either type a path or
click Browse to choose a project that uses source folders.
-
In the Folder Name field, type a name for the new source folder. If you choose a path that is nested
inside an existing source folder, you will see an error saying that you have nested source folders.
-
Check Update exclusion filters in other source folders to solve nesting.
-
Click Finish when you are done.
Java projects
Creating Java elements
Creating a new Java project
Creating a new Java package
Creating a Java project as its own source container
Creating a Java project with source folders
Creating a new source folder
New Source Folder wizard
Java Toolbar actions
Package Explorer