From 667ed940ef7c612816b2ce3d991d2e9974d08b24 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 20 Apr 2022 15:53:20 -0400 Subject: [PATCH] Fix run-command maven recipe to work with multi module projects --- emacs/.emacs.d/config/init-run-command.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/emacs/.emacs.d/config/init-run-command.el b/emacs/.emacs.d/config/init-run-command.el index 8d88309..461fcbe 100644 --- a/emacs/.emacs.d/config/init-run-command.el +++ b/emacs/.emacs.d/config/init-run-command.el @@ -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)