emacs vs ant
Geek
Here is a quick guide to getting the Java Development Environment for Emacs (JDE) running with Ant-based projects. I have want to get this working for ages (I have been using JDE as a glorified java-mode for half a decade now, although M-x jde-wiz-get-set-methods rocks).
I recently had a look at Netbeans and Eclipse again, but still I prefer Emacs, a terminal window and an Ant build file. The other two IDEs both force you to work how they want to work (Eclipse seemingly more so than Netbeans) and I am too old a curmudgeon to be pushed around like that. Given I really just want a quick way to get to compiler errors in my source code, I figured that I should finally get JDE doing that for me. This is how I did it:
-
M-x jde-mode <Ret>You need to have jde-mode loaded before anything below works. I am assuming you already have Emacs, JDEE and Ant installed. Installing Ubuntu may well be the fastest way of doing that.
-
M-x customize-variable <Ret> jde-jdk-registryAdd at least one JDK to the registry. I just added my default JDK as installed under Ubuntu. The version string is for your reference, but the path needs to point to a Sun-like $JAVA_HOME directory.
-
M-x customize-variable <Ret> jde-jdkMake sure your prefered default JDK is selected.
-
M-x customize-variable <Ret> jde-build-functionChange this to
jde-ant-build. M-x jde-ant-show-options <Ret>Scan through the Ant-related options and set what you need to. I set the following:
jde-ant-programset to the name of the ant script (or full path if it is not on your $PATH)jde-ant-argsmust contain-emacsjde-ant-read-targetset to onjde-ant-enable-findset to onjde-ant-complete-targetleft on
These options allow JDEE to find your build file, prompt you for a target name (not as painful as it sounds - defaults to the default target the first time and the last used target after that and does target name completion) and execute Ant.
That is it. Load up a Java file, make a change and issue C-c C-v C-b (or select "Build" from the JDE menu). Ant is invoked and you are taken to the appropriate lines in any source files that contain errors. Nice!
It should be mentioned that JDE has its own user guide, but I find it too long and sparse (and too annoying with the Table-Of-Contents applet). So I am going to continue to write up notes here.
Comments
How do you set the base directory for the project on which you're working? When I build now it tries to do it from the directory of the file in the current buffer.
Posted by: CT on June 10, 2005 08:57 PM
Hey, that is why you want 'jde-ant-enable-find' set to true.
Posted by: Mike on June 21, 2005 12:07 AM
1) M-x jde-ant-show-options
2) Set the Jde Ant Working Directory Variable (it's the last on on the page)
Posted by: Stan on July 12, 2005 08:35 AM
Add a Comment