pom-parser
I’ve been trying to use pom-parser.el with maven 2.0.8. It seems that the maven.dep.cpFile property isn’t working. I checked the docs for the plugin, and it says that parameter is deprecated, replaced with outputFile.
http://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html#cpFile
So I tried the outputFile and that didn’t work either, for me output always goes to stdout, never to the file.
I’m using the latest pom-parser.el from http://svn.grumblesmurf.org/svn/pom-el/trunk/pom-parser.el , GNU Emacs 23.0.60.1, and maven 2.0.8
I took a shot at parsing the output to capture the classpath. I was thinking that this function,or a better one
could parse the output of the two goals( effective pom and the dependency classpath) instead of two temp files in ‘pom-parse-pom’.
--- pom-parser-orig.el 2008-03-12 21:42:24.359375000 -0400 +++ pom-parser.el 2008-03-12 22:00:12.906250000 -0400 @@ -115,8 +115,7 @@ (cdr cached-pom-data) (message "Calling %s help:effective-pom dependency:build-classpath..." pom-maven-command) - (let ((temp-pom (make-temp-file temporary-file-directory)) - (temp-cpfile (make-temp-file temporary-file-directory))) + (let ((temp-pom (make-temp-file (concat temporary-file-directory "pom.") nil ".xml"))) (with-current-buffer *mvn-output-buffer* (erase-buffer)) (if (> (let ((default-directory (file-name-directory pom-file))) @@ -127,23 +126,39 @@ "dependency:build-classpath" (concat "-Doutput=" temp-pom) "-DincludeScope=compile" - "-DincludeTypes=jar" - (concat "-Dmaven.dep.cpFile=" temp-cpfile))) + "-DincludeTypes=jar" )) 0) (progn (display-buffer *mvn-output-buffer* t) (error "%s call failed" pom-maven-command)) (let ((pom (pom-parse-pom-file temp-pom))) - (if (null pom) + (message "length pom: %s" (length pom)) + (if (or (null pom) (= 0 (length pom ))) (error "Failed to parse effective POM; the contents of %s might help diagnose" temp-pom) - (let ((classpath (pom-parse-classpath-file temp-cpfile))) + (let ((classpath (pom-parse-classpath-buffer))) + (message "classpath: %s" classpath) (push (cons 'pom:classpath classpath) (nth 1 pom))) (puthash pom-file (cons pom-file-last-mod-time pom) *pom-cache*) (delete-file temp-pom) - (delete-file temp-cpfile) pom))))))) +(defun pom-parse-classpath-buffer () + "" + ;;(display-buffer *mvn-output-buffer*) + (with-current-buffer *mvn-output-buffer* + (goto-char (point-min)) + (let ((line-before-classpath (search-forward "Dependencies classpath:" nil t))) + (message "line-before-classpath: %s" line-before-classpath ) + (if line-before-classpath + (progn + (forward-line) + ;;buffer-substring + ;;(message "point-bol: %s point-eol: %s" (point-at-bol) (point-at-eol)) + (let ((tmp-classpath (buffer-substring-no-properties (point-at-bol) (point-at-eol)))) + (split-string tmp-classpath path-separator))) + (error "failed to find classpath in mvn dependency:build-classpath output"))))) + (defun pom-parse-classpath-file (classpath-file) (with-temp-buffer (insert "(\"")
I also found that in my prj.el I needed to specify *pom-node*:
(jde-project-file-version "1.0")
(jde-set-variables
'(jde-compile-option-command-line-args
(quote ("-Xlint:all" "-Xlint:-serial"))))
(require 'pom-parser)
(with-pom ()
(pom-set-jde-variables *pom-node*))
About this entry
You’re currently reading “pom-parser,” an entry on Evadnoob
- Published:
- March 15, 2008 / 1:34 am
- Category:
- emacs
- Tags:
- emacs maven
No comments yet
Jump to comment form | comments rss [?] | trackback uri [?]