Fix run-command maven recipe to work with multi module projects

This commit is contained in:
Jeremy Dormitzer 2022-04-20 15:53:20 -04:00
parent 4c67ca0fcf
commit 667ed940ef

View File

@ -216,7 +216,8 @@
: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")))
(when-let* ((root-dir (or (projectile-project-root) default-directory))
(project-dir (locate-dominating-file root-dir "pom.xml")))
(list
(list :command-name "validate"
:command-line "mvn validate"
@ -224,8 +225,11 @@
(list :command-name "compile"
:command-line "mvn compile"
:working-dir project-dir)
(list :command-name "clean compile"
:command-line "mvn clean compile"
:working-dir project-dir)
(list :command-name "test"
:command-line "mvn test"
:command-line "mvn test -DfailIfNoTests=false"
:working-dir project-dir)
(list :command-name "package"
:command-line "mvn package"
@ -251,7 +255,7 @@
(fboundp 'dap-java-test-class)
(dap-java-test-class))))
(list :command-name "test this class"
:command-line (format "mvn test -Dtest=%s" test-class)
:command-line (format "mvn test -DfailIfNoTests=false -Dtest=%s" test-class)
:working-dir project-dir))
(when-let ((test-method (and (buffer-file-name)
(let ((case-fold-search nil))
@ -259,7 +263,7 @@
(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)
:command-line (format "mvn test -DfailIfNoTests=false -Dtest=%s" test-method)
:working-dir project-dir)))))
(defun get-cargo-commands (dir)