Bug 546203 - Conditional breakpoint error despite maven sources are regular linked
Summary: Conditional breakpoint error despite maven sources are regular linked
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.11   Edit
Hardware: Macintosh Mac OS X
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-08 11:24 EDT by Alessandro Castriotta CLA
Modified: 2024-04-18 07:17 EDT (History)
3 users (show)

See Also:


Attachments
Opened editors (6.89 KB, image/png)
2022-04-28 03:19 EDT, Stefan Fussenegger CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Castriotta CLA 2019-04-08 11:24:20 EDT
I have the following error on Eclipse 4.11.0 using a conditional breakpoint over a class of a maven dependency:

Conditional Breakpoint Error

Conditional breakpoint has compilation error(s).

Reason:
Unable to compile conditional breakpoint - missing Java project context.

Conditional breakpoints works perfectly with any java source, but not with maven dependencies.

With older versions (for example, Oxygen) it worked perfectly.

Thanks for your attention.
Comment 1 Dani Megert CLA 2019-04-09 03:38:53 EDT
Please either provide steps to reproduce the problem or attach an example project.
Comment 2 Alessandro Castriotta CLA 2019-04-09 05:38:42 EDT
Of course.

1. Create a simple Maven project
2. Add some dependencies in the pom.xml
3. Create a Java main class that uses some classes of the dependencies
4. Create a new breakpoint in a class of a dependency
5. Debug the main class

In my case, at the point 4. the conditional breakpoint doesn't solve any variable.
At the point 5. I have the error I showed.

However, Eclipse opens the source of the class, but in the same way as a regular file not linked to any source (so, you haven't any Java feature, you can't do CTRL-click, etc....)

But I can regularly open the library class in the correct view from the main class.

There's not connection between the maven sources and the java project in debug mode.
Comment 3 Dani Megert CLA 2019-04-09 09:51:59 EDT
Looks like the build path is not correct.
Comment 4 Alessandro Castriotta CLA 2019-04-09 11:41:10 EDT
The build path is correct, is not an issue related to the build path, because the same project, opened with an older version of Eclipse, is working!
Comment 5 Alessandro Castriotta CLA 2019-04-09 11:46:39 EDT
If it can be useful, I can solve the problem making "Edit source lookup", and checking the option "source for duplicate sources".

The sources seems duplicated: I have both the class and the java file taken from the -sources.jar file in .m2 folder
Comment 6 Alessandro Castriotta CLA 2019-04-09 11:56:21 EDT
So Eclipse seems to prefer the .java file by default, taken from the maven -sources jar file, but this file is not linked to the project like the .class file.

The strange thing is that if I open the .class file, I can see the source as I open the .java file.
Comment 7 Eclipse Genie CLA 2021-03-30 06:16:46 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Stefan Fussenegger CLA 2022-04-28 03:19:13 EDT
Created attachment 288484 [details]
Opened editors

Opened files from
1) Debugger
2) Open Type
Comment 9 Stefan Fussenegger CLA 2022-04-28 03:25:49 EDT
I still have the same issue. It doesn't seem to be about conditional breakpoints only but the way debugger opens classes from Maven dependencies (see attachment "Opened editors").

The first tab (with the "J" icon) is opened by debugger. Hovering over it shows the path as a tooltip and it's "~/.m2/repository/.../*-sources.jar/../*.java".

The editor opened by "Open Type" (with the "010" icon) has the qualified class name as tooltip.

So for some reason debugger chooses to open the source like an external source file, hence the "missing Java project context".
Comment 10 Andrey Loskutov CLA 2022-04-28 03:31:10 EDT
Please open a bug for m2e. Source lookup is delegated to the launch providers, so if m2e configures somehow sources it should make sure this is done in the way, *right* sources are found.
Comment 11 Stefan Fussenegger CLA 2022-04-28 03:43:16 EDT
I've opened https://github.com/eclipse-m2e/m2e-core/issues/659
Comment 12 Eclipse Genie CLA 2024-04-18 07:17:21 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.