java - Programmatically capture compiler errors from Eclipse -


i trying write program can extract compiler errors (or other things bad build paths) eclipse's "problems" view.

i have not been able find documentation on how might done.

i've got 3 possible solutions you:

don't use eclipse

this easiest way go. eclipse producing visual presentation of build errors, , want structured presentation, they're bad match.

on other hand, if run javac command-line, output easy capture , relatively easy parse right there. if need more precise in parsing errors, @ running javacompiler in code , providing custom diagnosticlistener it.

if it's important capture nuances of eclipse compiler, can run command line (in batch mode). there's nice blog post describes process here: ecj - eclipse compiler java. here's short version: find ecj jar in eclipse distribution (mine in plugins/org.eclipse.jdt.core_3.8.3.v20130121-145325.jar) , run on command line

java -jar <ecj.jar> <sourcefiles> 

naturally, can run within java finer control.


use gui automation fetch errors

this clumsy, useful testing scenarios, want automated tester verify eclipse project builds way expect.

you can use tool autohotkey or sikuli or awt robot automatically fetch errors. simplest routine can think of goes this:

  1. click on "problems" tab bring front
  2. click on "errors" top-level node, selecting it
  3. type hot-key copy; errors copied clipboard, 1 per line
  4. paste or otherwise dump clipboard file
  5. repeat 2-4 other categories want capture, "warnings"

rewrite eclipse plugin

finally, if want need kind of real-time capture of error messages that's transparent user, you're stuck this.

you'll need go eclipse source code, definition of "problems" view , modify pass code information on side. whoever needs have use custom-built version of eclipse , not standard version.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -