vim-test icon indicating copy to clipboard operation
vim-test copied to clipboard

wrong module name in maven multi-level projects

Open gagara opened this issue 2 years ago • 0 comments

If I have maven multi-level project, e.g.:

mavenproject
  module1`
    submodule1A
    submodule1B
  module2
    submodule2C

and I want to run test in submodule1A then maven runner tries to use -pl submodule1A which fails with "unknown maven module". Instead -pl module1/submodule1A should be used to run maven. I tested following:

--- a/autoload/test/java/maventest.vim
+++ b/autoload/test/java/maventest.vim
@@ -58,10 +58,9 @@ endfunction
 
 function! s:get_maven_module(filepath)
   let project_dir = s:GetJavaProjectDirectory(a:filepath)
-  let l:module_name = fnamemodify(project_dir, ':t')
   let l:parent = fnamemodify(project_dir, ':p:h:h')
   if filereadable(l:parent. "/pom.xml") " check if the parent dir has pom.xml
-      return ' -pl '. module_name
+      return ' -pl '. project_dir
   else
       return ''
   endif

works for me.

gagara avatar Aug 06 '22 09:08 gagara