Regular expressions and Java/ANT **Please Help**

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
John Averty

Regular expressions and Java/ANT **Please Help**

Post by John Averty »

I can't figure out how to adapt the java compile tool reg expression to ANT. Note ANT is a build tool for Java.

The difference is in the outpt, and I'd like to adapt the reg expression to be able to jump to the file / line in this output. Below an example. As you notice, it is very simlar to the the java compile tool out put, basically it just inserts stuff at the beginning of the line:

>>>> Java compile output >>>>

C:\src\WWServlet.java:290: cannot resolve symbol
symbol : variable ServletSession
location: class com.webwarecorp.html.WWServlet
final ServletSession us = ServletSession.getSession(sessionID);
^
2 errors

Tool completed with exit code 1

<<< end Java compile output <<<<


>>>>ANT output >>>>

compile:
[javac] C:\src\WWServlet.java:290: invalid method declaration; return type required
[javac] public TreeNodeDelegsate(TreeDelegateBean treeDel, String name, String path, boolean bIsRoot) {
[javac] 1 error

BUILD FAILED

Tool completed successfully

<<< end ANT output <<<<

Please help!!!

Thanx,

John
jeyaraj

Re: Regular expressions and Java/ANT **Please Help**

Post by jeyaraj »

try this

^.\{12\}\([A-Za-z]:[^:]+\):\([0-9]+\):

jeyaraj
Mike

Re: Regular expressions and Java/ANT **Please Help**

Post by Mike »

I'm also having problems with Ant error messages. Jeyaraj, thanks for your reply, but your RE doesn't account for the " [javac] " that Ant prepends to compiler messages.

You can run Ant with the "-emacs" option to eliminate the prefix so the compiler error message is not modified. However, I've tried all the RE's suggested in this forum (including TextPad's default Java RE) and none work with Ant output.

Has anyone actually gotten TextPad working with Ant output? If so, how did you configure it?

Thanks,
Mike
Jeyaraj

Re: Regular expressions and Java/ANT **Please Help**

Post by Jeyaraj »

The regexp i pasted is the working one for me.

let me explain the steps.

1) select Configure ---> Preferences ---> Tools
2) Click on the Add button and select Program... from the drop down
3) locate the ant.bat and select it (eg. D:\jakarta-ant-1.4.1\bootstrap\bin\ant.bat)
4) Click "Apply" and Rename the new Ant entry if needed
5) Now Select the added Entry and remove what is there in "Parameters"
5) Type-in the folder where the build.xml is there in "Initital Folder"
6) Make sure "Capture Output" is checked
7) in the RegExp box type
^.\{12\}\([A-Za-z]:[^:]+\):\([0-9]+\):

8) Make sure the Registers read as

File - 1 Line - 2

9) click okey to save the setting and Thats all.

On compilation Ant produces a error line with first 12 charectors with [java] and so and the regexp is omitting the first 12 charecters and group the file name and the line no (which follows the first 12 charecters).

Hope it helps

jeyaraj
Mike

Re: Regular expressions and Java/ANT **Please Help**

Post by Mike »

Jeyara,
Thanks for your detailed reply. Of course, your RE is fine; I misread "\{12\}" as "\{1,2\}". However, after following your configuration, it still doesn't work. What version of TextPad do you have? Mine is 4.5.0 (32-bit edition).

Thanks for your help,
Mike
Mike

Re: Regular expressions and Java/ANT **Please Help**

Post by Mike »

Got it, finally. I need to remove the "\" in front of "(". Maybe because I had set the option for POSIX REs? Anyway, here's the RE I used:

^.*([A-Za-z]:[^:]+):([0-9]+):

It works with both "ant build" and "ant -emacs build" (or with any other target). Very nice!

Mike
Post Reply