Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: XXX is not a valid line number in YYY

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?

like image 314
Jonathan Livni Avatar asked May 24 '11 08:05

Jonathan Livni


1 Answers

Press Ctrl+Shift+R and enter YYY.java. Eclipse will then tell you which YYY.java it 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.jar This file must be in the same directory as some-version.jar for 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 ...

like image 188
Aaron Digulla Avatar answered Sep 22 '22 12:09

Aaron Digulla