Today I cameÂ an issue that required me to debug a custom Ant task that we have. While the Eclipse integrated debugger allows you to step through the targets and tasks in the build.xml file using the action Debug As -> Ant Script, it doesn’t actually let you step into the java class that implements the task. This is a major drawback, as most of the complexity (and issues :-)) tend to be in the task implementation code.
After searching around for a bit, I came across the Eclipse Remote Debugger debug configuration. This configuration allows you to remotely debug applications, by establishing a JDWP (Java Debug Wire Protocol, part of JPDA – Java Platform Debug Architecture) connection between the running application and the debugger. After learning about this, setting up the environment to debugg Ant tasks from within Eclipse was pretty straightforward.
The first step is to setup the Ant script launcher to run in debug mode and attach to the debug server. The following should be used as JRE arguments for the Ant configuration:
You can setup your Ant configuration by going to Run -> External Tools -> External Tools Configurations and creating a new Ant Build configuration. Inser the location of the build file in the main tab and setup the arguments in the JRE tab:
After the Ant configuration is setup, we need to take care of the remote debugger configuration. Go to Run -> Debug Configurations… and create a new configuration for Remote Java Application. Make sure you set the same port number that you used in the Ant configuration, and you are good to go.
Now, place the breakpoints in your build.xml and java classes. In order to debug, you need to first launch the Ant script and then attach the debugger to it. Do right click in the build.xml file and select Debug As -> Ant Script. Then go to Run -> Debug Configurations… select the Remote Ant Debugger and click Debug. The debugger will now attach to the running proccess and let you step through both the xml file and the java classes:
When I migrated my development environment to Eclipse 3.4 Ganymede, one of the things that caught my attention on Eclipse’s update website was a plugin called Mylyn. A visit to the website, a look over the webcast and it sounded something promising.
It definitely is! Mylyn is a task manager that changes your IDE context based on tasks. You create a task, add resources to its context and when you activate the task, it hides all the other (unneeded) resources from your views (project/package explorer, outlines, editors, etc…). It provides integration with several task repositories, like Bugzilla and Trac. Unfortunately, it doesn’t provide a connector to Clearcase, but I’m still able to use it in an automated way.
I find the tool really awesome when I do something basic like switching tasks: it just closes all the editor windows and projects in the explorer for the task I’m leaving and opens all the files I was working on for the task I’m switching to. This would take me several minutes to do by myself, so having a tool that does that in 1 second is pretty neat!
Here are some more things I like about Mylyn:
And the things I don’t like that much:
Overal, I think Mylyn is a great tool and very useful! Even more if you are working with Bugzilla/Trac projects.
I have been wanting to write a few technical articles here on the blog, so I’ll start with something that is related with what I have been looking into at work: Static and Dynamic SQL.
From the conversations I have had with both DBAs and developers, it is clear that DBAs prefer static SQL, while developers prefer Dynamic SQL.
The difference between static and dynamic SQL is that static SQL needs to be compiled and bound to the database before application runtime, while dynamic SQL is compiled during runtime. Next, I’ll show a list of pros and cons regarding each one.
better statistics. Because the statement is compiled at runtime, it uses the latest statistics available, contributing to a better execution plan.
As you can see, there are several reasons why you would choose one over the other. There is no perfect solution! But if you ask me, I would suggest the following: use Static SQL if security is your main concern and use Dynamic SQL if ease of development is your main concern.