Build with ant, open source files in TextPad, jump to lines with compilation errors
I use cygwin and textpad in my day-to-day work, among many other things. To compile my current java project, I use ant. I'm always interested in integrating utilities to make everything more convenient, so this afternoon I set out to create an entry in the textpad "Tools" menu, to run ant and compile my source code.
I found what seemed like useful information here, so I was able to at least run ant from textpad. However, compilation errors would show up in the "Command Results" window, and the part on that web page about being able to click on a compilation error to jump to the offending file and line number was not working for me. I tried messing with the regex and switching my textpad regex type from POSIX to the textpad default type, but I could not get it to work.
So, I went a different route. I decided to attack it from the bash shell angle, by running ant and manipulating the output. What I ended up with is one string of commands that runs ant, then opens all source files with compilation errors into textpad, and jumps to the line numbers that the errors occurred on:
ant 2>/dev/null ¦ grep "\[javac\] [A-Za-z]:" ¦ sed -e "s/^ *\[javac\] \([A-Za-z]:[^:]*\):\([0-9]*\):.*$/\1(\2)/g" > /cygdrive/c/temp/textpadant.txt ;
I will probably try to expand on this a little further when I have time, so I can initiate all this from inside textpad, as an entry in the "Tools" menu. It should be pretty easy, but I don't have time to mess with it any more right now. For now, the solution I came up with will already save me some time every day.
-dave
