While debugging a large scale project, I use links in the log printout to jump straight to the relevant file and line. Alas in many cases I get the following pop-up:
XXX is not a valid line number in YYY.java
On the main sub-window there’s also the following message:
The JAR file M2_REPO\org\apache\...\some.jar has no source attachment.
Of course I checked that:
- M2_REPO (defined under Window\Preferences\Java\Build Path\Classparth Variables) points to the maven repository correctly
- the path and filename in the message above is correct and the file exists
- YYY.java has line XXX and indeed it is the source of the log message
What could possibly make eclipse mistake in this trivial task?
What other configuration might be set wrong?
Press Ctrl+Shift+R and enter
YYY.java. Eclipse will then tell you whichYYY.javait can see. Chances are that it sees more or other source files than you expect.If there is just a single file, make sure it’s the correct version. Maybe Eclipse mixes a new bytecode JAR with an old source JAR.
The maven error message means that it’s missing
M2_REPO\org\apache\...\some-version-sources.jarThis file must be in the same directory assome-version.jarfor Eclipse to attach the sources to the binary JAR.If you have the sources, copy it there. If you don’t have them, there is a chance that Eclipse can download them for you. Open the context menu for the project -> Maven -> Download sources … wait …