summaryrefslogtreecommitdiffhomepage
path: root/prog/jao-java-ant.el
blob: 27c6420601d4480c1af7be0d622f46776c66ae6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(require 'jao-dominating-file)

(eval-after-load 'cc-mode
  '(progn
     (add-hook 'java-mode-hook
               (lambda ()
                 (set (make-local-variable 'compile-command) "ant")))
     (define-key java-mode-map "\C-cc" 'jao-java-ant-build)))

(defun jao-java-ant-build ()
  (interactive)
  (let ((build-file (jao-locate-dominating-file "build\\.xml")))
    (unless build-file
      (error "Couldn't find associated build file"))
    (let ((default-directory (file-name-directory build-file)))
      (call-interactively 'compile))))

(provide 'jao-java-ant)

;; End of jao-java-ant.el