Source Lookup in Eclipse with CustomOutput Folders

Hello

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:
https://github.com/DerMuedeJoe/buildship/commits/bugfix/source_lookup

The project setup is pretty easy:
`- Project a that has compile dependency on project b

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:

  • JavaSourcePathComputer tries to compute all SourceContainers calling: JavaRuntime.resolveSourceLookupPath
  • The StandardSourcePathProvider will be used
  • Finally this will end up in calling: GradleClasspathContainerRuntimeClasspathEntryResolver which will return the output folders.

Unfortunately introduced by myself as needed by the runtime classpath:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=507206

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

Thank you for the detailed report! Would you mind opening an issue at github.com/eclipse/buildship? Given all the information (even test cases, awesome!) I’m sure we can find a fix.

Sure:

So i will flag this Thread as resolved.
If have have some spare time i will try a fix.

Thank you.