Add maven run-command recipe

This commit is contained in:
Jeremy Dormitzer 2022-04-01 11:08:53 -04:00
parent 2d38afd418
commit d2f17e9df8

View File

@ -215,6 +215,48 @@
(list :command-name "install"
:command-line (format "pip install -r %s" (buffer-file-name))))))
(defun run-command-recipe-maven ()
(when-let ((project-dir (locate-dominating-file default-directory "pom.xml")))
(list
(list :command-name "validate"
:command-line "mvn validate"
:working-dir project-dir)
(list :command-name "compile"
:command-line "mvn compile"
:working-dir project-dir)
(list :command-name "test"
:command-line "mvn test"
:working-dir project-dir)
(list :command-name "package"
:command-line "mvn package"
:working-dir project-dir)
(list :command-name "verify"
:command-line "mvn verify"
:working-dir project-dir)
(list :command-name "install"
:command-line "mvn install"
:working-dir project-dir)
(list :command-name "deploy"
:command-line "mvn deploy"
:working-dir project-dir)
(list :command-name "clean"
:command-line "mvn clean"
:working-dir project-dir)
(when-let ((test-class (and (buffer-file-name)
(string-match-p ".*\\(Test\\|IT\\).*\\.java$" (buffer-file-name))
(fboundp 'dap-java-test-class)
(dap-java-test-class))))
(list :command-name "test this class"
:command-line (format "mvn test -Dtest=%s" test-class)
:working-dir project-dir))
(when-let ((test-method (and (buffer-file-name)
(string-match-p ".*\\(Test\\|IT\\).*\\.java$" (buffer-file-name))
(fboundp 'dap-java-test-method-at-point)
(dap-java-test-method-at-point t))))
(list :command-name "test this method"
:command-line (format "mvn test -Dtest=%s" test-method)
:working-dir project-dir)))))
:general
(leader-map "\"" #'run-command)
:custom
@ -232,6 +274,7 @@
run-command-recipe-pytest
run-command-recipe-nosetests
run-command-recipe-web-ext
run-command-recipe-pip)))
run-command-recipe-pip
run-command-recipe-maven)))
(provide 'init-run-command)