Currently we are suffering an issue when working with custom output folders on custom source folders in Eclipse. Unfortunately the custom output folders will be assigned to lookup the sourcecode and not the projects source folders.
Working with the latest Buildship 2 and latest Eclipse Neon. To be precise:
- Neon.2 Release (4.6.2) Build id: 20161208-0600
- Buildship: 2.0.1.v20170213-2317-s
I have created unit tests to show this behaviour:
The project setup is pretty easy:
`- Project a that has compile dependency on project b
- Project b with custom scrDir and custom output dir
SourceCode to see the setup:
Debug this example with a default Launch Configuration an stepping into the project b’s code will never show the SourceCode:
I did some debugging on this:
JavaSourcePathComputertries to compute all SourceContainers calling: JavaRuntime.resolveSourceLookupPath
StandardSourcePathProviderwill be used
- Finally this will end up in calling:
GradleClasspathContainerRuntimeClasspathEntryResolverwhich will return the output folders.
Unfortunately introduced by myself as needed by the runtime classpath:
The stack would look like this:
This can be easily triggered by creating a new Launch Configuration and switch to the ‘Source’ Tab.
Project in my case would be ‘a’
I did not find any quick fix on this.
Probably it would end up in writing a custom SourcePathProvider.
I guess the Classpath lookup (Runtime) cannot be handled with the same class as the SourceCode lookup. In this case the
GradleClasspathContainerRuntimeClasspathEntryResolver. Manually clicking the projects together in Eclipse (without gradle) will show the project to lookup the source.
If necessary i will raise a Bug report on this. I cannot provide a solution at the moment within my fork. I am not sure if there is a better solution or if i am completly right on this. Maybe i need to get some inspiration from the click created Workpsace.
Manually add the Project is an easy workaround, so the impact is not severe but annoying.
Any suggestions are welcome. Thanks.
Workarounds to evade:
- Don’t use custom output folders
- Manually add projects if sourcelookup fails