Created
September 18, 2011 12:26
-
-
Save antonj/1225030 to your computer and use it in GitHub Desktop.
Flymake emacs-eclim java project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; (require 'flymake) | |
(defvar flymake-eclipse-batch-compiler-path | |
"/Applications/eclipse/plugins/org.eclipse.jdt.core_3.7.0.v_B61.jar") | |
;; TODO fix hardcoded 1.6 | |
(defvar flymake-java-version "1.6") | |
(defun flymake-java-ecj-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-ecj-create-temp-file)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name)))) | |
(list "java" (list "-jar" flymake-eclipse-batch-compiler-path "-Xemacs" "-d" "none" | |
"-warn:+over-ann,uselessTypeCheck";;,allJavadoc" | |
"-source" flymake-java-version "-target" flymake-java-version "-proceedOnError" | |
"-classpath" (eclim/project-classpath) | |
;; "-log" "c:/temp/foo.xml" | |
local-file)))) | |
(defun flymake-java-ecj-cleanup () | |
"Cleanup after `flymake-java-ecj-init' -- delete temp file and dirs." | |
(flymake-safe-delete-file flymake-temp-source-file-name) | |
(when flymake-temp-source-file-name | |
(flymake-safe-delete-directory (file-name-directory flymake-temp-source-file-name)))) | |
(defun flymake-ecj-create-temp-file (file-name prefix) | |
"Create the file FILE-NAME in a unique directory in the temp directory." | |
(file-truename (expand-file-name (file-name-nondirectory file-name) | |
(expand-file-name (int-to-string (abs (random))) (flymake-get-temp-dir))))) | |
(push '(".+\\.java$" flymake-java-ecj-init flymake-java-ecj-cleanup) flymake-allowed-file-name-masks) | |
(provide 'flymake-eclim-java) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment