I do not think that it is possible to make Eclipse to compile sources in several locations.
In such situations, I created another project inside the workspace into which I link sources from different places. So, I will have the main project that is used for deployment. Then I will have another project that is used for something else, in this case testing. In your case, another project will link the sources from the main project.
The only problem I ran into is that I did not find out how to link sources using relative paths.
To link the source folders, you must use the Project properties โ Java build path โ Source โ Source Source.
Most likely, you will need some resources from the main project. You can create the same directory structure inside another project by creating link folders. When creating a folder in a project, you can choose from the additional options "Link to a folder in the file system".
Lauri source share