How to get Ant build errors inside Eclipse "Problems" view - eclipse

When I set up an Ant script to run as an Ant builder in an Eclipse project, the only options I have for handling the output are to:
show it in Console view
capture it in a file
Is there any way to tell Eclipse how to parse the output and add entries to the Problems view accordingly?

I don't think you are going to find a solution, but if you do it would have to be a third-party plugin implementing a replacement Ant Builder. As you've discovered, Eclipse Ant build integration doesn't support this.
You may also want to consider opening an enhancement request at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform site. While there is no guarantee that someone will step up to implement this feature, you never can tell.

Related

Detect error in Eclipse Ant builder

I have defined a custom builder for an Eclipse project (Project -> Properties -> Builders -> New ...)
The task that the Builder does is not important, since it is working correctly.
The problem is then: what happens if, for example due to the configuration of the developer, such Builder fails? An error is shown in the console, but the project is not marked as "failed". I would like the project to be marked as failed, since the developers are used to watch for red crosses in the Package Explorer and not to proceed if they see it.
Can I somehow configure the builder to do so? Any idea how? Any workaround?
Thanks,
The Laid Problem Marker plug-in is a tool for creating problem markers from builder output.
The plug-in adds a Problem Markers tab to the build configuration dialog for Program builders and Ant builders.
Screenshot:
A custom build output parser can be created either with a regex or by implementing a parser in Java. The parser is passed the console output from the builder, and the result from the parser is used to put problem markers on project resources that appear in editors and the Problems view.
See to project description for details.
The plug-in can be installed using the Install New Software GUI from the project update site:
https://bitbucket.org/lii/laid_language_tools/raw/master/se.lidestrom.laid.update_site/
Disclaimer: I am the project author.

Create plug-in that creates a snapshot of the source code currently opened on editor - Eclipse CDT

I need to create a plug-in for Eclipse CDT that sends a "snapshot" of the source code of the currently opened editor each time the code is "built".
I am already capable of doing it each time the user presses a custom button created by me, but it would be great if it could be done when the "standard" "build" action is performed.
Do i need no create a plug-in of the type "builder"?
I am using Eclipse 4.4.0...
Can someone help me?! (Sorry for some english mistakes... :( )
One solution would be to create your own custom "Builder". Instead of actually building the code, it would invoke the functionality you already have.
For information on how to use the eclipse build system, please have a look here: https://wiki.eclipse.org/Eclipse/FAQ/How_do_I_implement_an_Eclipse_builder%3F.
Also, this website goes into more details about building in eclipse: https://www.eclipse.org/articles/Article-Builders/builders.htm. However, I think that the first one should do.
As a side note, this works with any kind of eclipse project (JDT and CDT). The build described there is common to all flavours.
Hope it helps,
-Caius

Where should I look at in Eclipse source code to figure out how Eclipse generate JUnit testing result?

I'm analyzing Apache ant source code for my research. When a test suite runs, test cases are executed and Eclipse shows the test result as the image below. My goal is to get the executed test case names as Eclipse does. If I can see source code where Eclipse handles this, I think I can get the name list. Therefore, I'd like to know the source code location where Eclipse handle this or an easier way to achieve the goal... I tried using JUnit task in an ant build script to generate the test report so that I can get the test list by parsing the text/xml report. I could get the report with some warnings stating that duplicate classes are detected because I'm testing ant with ant. However, the report showed the test method name without its full class name...
Well, there is a short workaround for what you want to achieve (to have a specific, deterministic test run order), it is the #FixMethodOrder annotation on your test class. That will make your tests run in a specified order in every environment (or at least it should :-)).
If you want to do it in the hard way (analyze the source code of the Eclipse JUnit runner), I would advise installing the PDT tools and sources of the plugins first, and also set the Include all plug-ins from target in Java search under the Plug-in Development options (so you can find the plug-in types easily with Ctrl+Shift+T/R).
Then you have the Plug-in Spy which is a rock of a feature: press Alt+Shift+F2 and click on any element on the UI. Then you get all the info where the given component in defined (alternatively, you can press Alt+Shift+F1 zo display data of the selected component). An example is below:

How to debug a plugin in Eclipse - i.e. a Java project without a Main method

I am currently trying to modify the behavior of an existing open-source plug-in for Eclipse.
I'm trying to understand how the plugin works. To do so, I opened it in "Debug" mode as an Eclipse application and I am testing it out after having inserted many breakpoints.
However, sine Eclipse plugins do not have a Main method, it's still really difficult for me to keep track of everything that is going on. The calls seem to jump arbitrarily (which I quickly realized was happening through all the interfaces and superclasses the plugin is inheriting) and I can't see exactly what's doing what.
What is the proper (read: BEST) way to debug a program with no Main method? How can I test, tweak, and explore and program - in this case a plugin - whose modus operandi I'm uncertain of?
You need to run your plugin in a runtime workbench. This (simplistically) starts a new instance of Eclipse with all existing plugins installed, plus the plugin you want to debug. Make sure that you have the PDE tools installed in your Eclipse instance and then in the debug configurations area, double-click on Eclipse Application to generate a default runtime workbench launch config.
I'd also recommend that you read up on PDE (plugin development environment), and you can get an overview here: http://wiki.eclipse.org/PDE/FAQ. And you can read up on plugins in general here: http://eclipsepluginsite.com/. There are many tutorials and lots of information all over the web. So, google is your friend.
Along with using breakpoints in Debug method you can even try printing stack trace using Thread.currentThread().getStackTrace() method to know the starting point of a Thread.

How do I get support for GPB in Eclipse?

I'm trying to use Google Protocol Buffers in my project and I'd like to have some tooling support from Eclipse. In particular, I want Eclipse to call protoc every time I make changes to the .proto files and then rebuild all code that depends on the generated code.
I tried to set up a Custom Builder but it keeps bugging me with errors I don't understand, most often it complains that the .proto file is not on the path given by --proto-path, which it should be by all I can tell. Also, because I use ${build_files}, Eclipse passes all changed files to the compiler (instead of those that I have configured to trigger the build).
NetBeans seems to have a protobuf-Plugin, but I can't find one for Eclipse. Is there one?
Theres a protoclipse plugin on googlecode, which is in the initial stages:
http://code.google.com/p/protoclipse/
Not sure if there is a builder, but I did find a plugin for syntax highlighting for protocol buffers.
You can define an external builder on the plugin that invokes an ant task. It is an ugly kludge, but until there is a better solution this may serve your purposes.
In practice, syntax highlighting turned out to not be that important, I hardly edit these files, and they tend to be very small. Maven and the m2eclipse plugin handle the building side of things great.
I recommend using Google's "Protocol Buffers Development Tools". It is a plugin for Eclipse that features automagic regeneration and error checking, among other things. It's available here: http://code.google.com/p/protobuf-dt/ .
While this question is close to other Eclipse plugin for working with protobuf, answers here are different.
Well, yes, if you use maven/gradle to invoke protoc (Protobuf compiler), than you may need no Eclipse plugin at all.
Colorizing editor helps for long file or with many comments. Know there are 2 editor plugins for Eclipse.