Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 86699 invoked from network); 20 Sep 2000 07:55:25 -0000 Received: from sebastion.sa.camtech.com.au (203.28.3.2) by locus.apache.org with SMTP; 20 Sep 2000 07:55:25 -0000 Received: (from smtp@localhost) by sebastion.sa.camtech.com.au (8.8.8+Sun/8.8.8) id RAA10194 for ; Wed, 20 Sep 2000 17:22:51 +0930 (CST) X-Authentication-Warning: sebastion.sa.camtech.com.au: smtp set sender to using -f Received: from shiraz(10.1.1.1) by sebastion-internal via smap (V2.0) id xma010188; Wed, 20 Sep 00 17:22:43 +0930 Received: from gattica (localhost [127.0.0.1]) by shiraz.camtech.com.au (8.9.1/8.9.1) with ESMTP id RAA17848 for ; Wed, 20 Sep 2000 17:27:14 +0930 (CST) Date: Wed, 20 Sep 2000 17:22:37 +0930 (CST) From: Barrie Treloar X-Sender: barrie@gattica To: ant-dev@jakarta.apache.org Subject: Get emacs to find the correct build.xml and automatically pass it to ant. In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N On 20 Sep 2000, Stefan Bodewig wrote: > It is useful for a lot of people I know - those using (X)Emacs/JDE can > now simply say "build using make" and set the make command to ant and > it will always pick up build.xml without the need to explicitly > specify the -buildfile switch, for example. To do this with Emacs/JDE do the following: (I'll add this to FAQ when its working :) Customize jde-build-use-make and set it to true. [This makes jde use make instead of its own internal builder] Customize jde-read-make-args and set it to true. [This makes jde prompt you for the arguments to give to make. You can just hit return if you dont want to pass any arguments (the common case), otherwise you can include the target you want invoked. Dont specify the build file to use, we will do this another way] Customize jde-make-program and set it to "ant". [This makes jde use "ant" instead of "make" as the build program] To your .emacs files add the following, this causes jde to try and load a prj.el file whenever you open a .java file. This allows us to do some black magic a bit later. ;; ;; JDE mode ;; (require 'jde) (add-hook 'jde-mode-hook '(lambda () (jde-load-project-file) )) For each project hierarchy create a prj.el file at the top level. JDE will search the directory hierarchy to find the prj.el file and use the first one it finds. For example, if you are in /src/org/apache/tools/ant/ and you load Main.java and the file /prj.el exists it will load it. The prj.el file will customize the jde-make-args to include the correct build file based on the java file that was loaded. The prj.el file should contain the following lisp code: ;;; ;;; BEGIN prj.el ;;; ;; ;; This file is loaded by JDE-mode via JDE->Project->Project File->Load. ;; The only value that requires changing is the jde-make-args variable ;; ;; Notes: It is important to use make-local-variable as this allows ;; each buffer to have its own version of the build.xml file. ;; Therefore two source files from two different projects will ;; correctly use the write build.xml file. ;; ; The location of the Ant build file. (make-local-variable 'jde-make-args) (setq jde-make-args "-f /build.xml") ;; You may want to add the following (this allows C-z C-z or ;; "compile" to use ant instead of "make") This is more natural to ;; old emacs hackers than C-c C-v C-b. ; ; Set C-z C-z to be the same as C-c C-v C-b inside jde major modes ; (local-set-key "\C-z\C-z" 'jde-build) ;;; ;;; END prj.el ;;; Happy hacking, Barrie -- Barrie Treloar ____________________________________________________________________ Barrie Treloar Phone: +61 8 8303 3300 Senior Analyst/Programmer Fax: +61 8 8303 4403 Electronic Commerce Division Email: barrie@camtech.com.au Camtech (SA) Pty Ltd http://www.camtech.com.au --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. --- ____________________________________________________________________