Try this..
;; Compilation Mode
;; to allow it to understand ant's output
;; (for regular expression help)
http://www.delorie.com/gnu/docs/elisp-manual-20/elisp_546.html
(load "compile")
(setq compile-command "ant")
(add-to-list 'compilation-error-regexp-alist
'("^\\s-*\\[[^]]*\\]\\s-*\\(.+\\):\\([0-9]+\\):" 1 2))
Amund Solvi Bremer wrote:
>
> I'm using ant (see jakarta.apache.org) for building my apps and I'll never
> write another makefile. Everyone should use ant!
>
> However, emacs is not able to parse the error messages from ant, so I can't
> use the goto error C-`.
>
> I suppose there is an easy way to configure emacs/JDE to do this. Ant inserts
> [javac] in front of any messages from javac (see below).
>
> Could anyone provide some hints?
>
> Typical compile buffer output with some errors is after C-c C-v C-b
>
> ---8<-----------
> cd c:/usr/home/pros/leipzig/src/indec/zarph/
> ant -buildfile c:/usr/home/pros/leipzig/build.xml
> Buildfile: c:\usr\home\pros\leipzig\build.xml
>
> init:
>
> prepare:
> [copydir] Copying 1 files to C:\usr\home\deploy\zarph\lib
>
> compile:
> [javac] Compiling 2 source files to C:\usr\home\deploy\zarph\classes
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:40:
> Invalid type expression.
> [javac] Class.forName ("com.internetcds.jdbc.tds.Driver")
> [javac] ^
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:41:
> Invalid declaration.
> [javac] cat.debug("Loading Driver finished");
> [javac] ^
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:42:
> Exception java.lang.ClassNotFoundException is never thrown in the body of
> the corresponding try statement.
> [javac] } catch(java.lang.ClassNotFoundException e){
> [javac] ^
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:43:
> Incompatible type for +. Can't convert java.lang.ClassNotFoundException to
> int.
> [javac] cat.error("DBManager(): Could not load driver: ",
> +e);
> [javac] ^
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:43:
> Incompatible type for method. Can't convert int to java.lang.Throwable.
> [javac] cat.error("DBManager(): Could not load driver: ",
> +e);
> [javac] ^
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:64:
> Method getConnection(java.lang.String, java.lang.String, java.lang.String)
> not found in interface java.sql.Driver.
> [javac] _con = Driver.getConnection(_url, _user, _pwd);
> [javac] ^
> [javac] C:\usr\home\pros\leipzig\src\indec\lib\db\DBManager.java:66:
> Exception java.sql.SQLException is never thrown in the body of the
> corresponding try statement.
> [javac] } catch(SQLException e) {
> [javac] ^
> [javac] 7 errors
>
> BUILD FAILED
>
> c:\usr\home\pros\leipzig\build.xml:84: Compile failed
>
> Total time: 16 seconds
>
> Compilation finished at Wed Sep 06 18:24:38
>
> ---8<-----------
>
> regards, a.
>
>
--
--------------------------------------------------------------------
Justin Dickmann Phone: +61 8 8303 3300
Analyst/Programmer - Electronic Commerce Fax: +61 8 8303 4403
Camtech R&D Pty Ltd http://www.camtech.com.au
--- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia ---
--------------------------------------------------------------------