Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jdt debugger does not find sources when Tycho Project Configurators is installed #32

Open
LorenzoBettini opened this issue Jan 25, 2017 · 8 comments

Comments

@LorenzoBettini
Copy link

If you have PDE projects with Maven nature (configured with Tycho), and you try to debug, e.g. a JUnit Test Case in a .tests project that tests a Java class in another project, then JDT debugger cannot find the sources of the classes of other projects (nor sources of possible dependencies used by the classes under test) if you have "Tycho Project Configurators" installed in your Eclipse.

For example, take the projects found here: https://github.com/LorenzoBettini/tycho-simple-example

  • if you do NOT have Tycho Project Configurators installed, then you can set a break point in MyClass(in project example.plugin) and you can debug such class running the JUnit test MyClassTest in the project example.tests: the debugger can seamlessly find the sources of MyClass.
  • If you install Tycho Project Configurators installed, then, during debugging the JUnit Test Case, the source of MyClass cannot be found.

Note that if this happens, and you uninstall the Tycho Project Configurators, debugger will work again (it will find the sources) ONLY if you use another fresh workspace or if you first remove a few folders in the .metadata directory (I did some tests and I had to remove .jdt., .debug. and .m2e.). Since I found no file left from the Tycho Project Configurators in the .metadata directory, can it be that m2eclipse-tycho interferes with some JDT indexes?

I'm using Eclipse Neon 2 and the Tycho Project Configurators taken from http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-tycho/0.9.0/N/LATEST

@LorenzoBettini
Copy link
Author

Apparently, the problem is only in the Tycho Project Configurators 0.9.x: with version 0.8.x, which is the one proposed automatically if you have projects configured with a tycho build, the problem is not there. I was using 0.9.0 since I thought it was the latest release, but probably that's not the case and it's only a snapshot?

@ifedorenko
Copy link
Contributor

You may want to try my "advanced" source lookup tech (can be installed form this p2 repository). It supports Debug As JUnit Plugin Test and Eclipse Application launch configuration and should be compatible with latest Eclipse and M2E releases.

LorenzoBettini added a commit to LorenzoBettini/packtpub-xtext-book-2nd-examples that referenced this issue Jan 27, 2017
@LorenzoBettini
Copy link
Author

@ifedorenko thank you for the suggestion, and I'll try that. However, the problem I was referring to happens when you debug from Eclipse as plain JUnit, not as JUnit Plugin Test.
Is the bug I reported known?
Is 0.9.0 officially released or should we stay with 0.8.0?

@LorenzoBettini
Copy link
Author

@ifedorenko I did some further investigations that I report here, hoping they're useful to fix this problem: when the Tycho project configurator 0.9.0 is used, the launch configuration adds these two additional entries:

<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>

which are responsible for NOT finding sources of other projects (including their dependencies).

Manually removing those two entries brings the launch configuration to a working state (sources of other projects and dependencies are correctly found during debugging). A working launch configuration can be found here: https://github.com/LorenzoBettini/tycho-simple-example/blob/78bbe0c28d38f0b6639ab007f07de0123f5a0d31/example.parent/example.tests/MyClassTest.launch. Upgrading the Tycho project configurator from 0.8.0 to 0.9.0 will modify this launch configuration to a NON working state adding the two above entries.

Can the problem be due to this commit fae253e? I see there's a comment from you (fae253e#diff-703464cb85074c6e19ca4d67df3b862fR132):

// igorf: Returned entries do not have attached sources. I am not actually sure this works.

LorenzoBettini added a commit to LorenzoBettini/jbase that referenced this issue Jan 31, 2017
@apupier apupier mentioned this issue Apr 21, 2017
@LorenzoBettini
Copy link
Author

Unfortunately I have some bad updates (I've just realized that after seeing #34): the problem is still there also with tycho project configurator 0.8.0 (and also with 0.8.1): as soon as I open an existing launch configuration in the Run Configurations... dialog the two above mentioned entries are automatically added:

<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>

breaking completely the debugging features...

Sources of other projects (and dependencies) are not automatically available for any new debug configurations, making debugging a real pain...

The only solution is to uninstall the tycho project configurator plugin and get run of the launches saved in the workspace org.eclipse.debug.core/.launches.

@ifedorenko
Copy link
Contributor

Have you tried advanced sourcelookup? I am debugging m2e and bunch of in-house projects without problems.

@LorenzoBettini
Copy link
Author

@ifedorenko where can I find "advanced sourcelookup"? I mean in which preference/configuration? Can you share some of the projects you're using?

Note that the problems I experience when debugging are due to sources in other projects from the one where I'm debugging (e.g., JUnit tests in a different project) and to sources of plugin (PDE) dependencies.

@ifedorenko
Copy link
Contributor

ifedorenko commented May 22, 2017

you can install it from https://repository.takari.io/content/sites/m2e.extras/sourcelookup/1.2.0/N/LATEST/

edit: the project github repo has some info about features and mode of operation https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants