Skip to content

Instantly share code, notes, and snippets.

@dansomething
Last active June 13, 2022 20:04
Show Gist options
  • Save dansomething/2b05ffb9e418187c1bb1ed13af77edfe to your computer and use it in GitHub Desktop.
Save dansomething/2b05ffb9e418187c1bb1ed13af77edfe to your computer and use it in GitHub Desktop.
vim-test with vim-dispatch strategy for a multi-module Maven, Java and Groovy project using Spock
" https://github.com/janko-m/vim-test
"------------------------------------
let test#strategy = "dispatch"
let test#enabled_runners = ["groovy#maventest", "java#maventest"]
let g:test#groovy#maventest#defaultoptions = '-DfailIfNoTests=true -Dmaven.test.redirectTestOutputToFile=false'
let g:test#groovy#maventest#options = g:test#groovy#maventest#defaultoptions . ' -DargLine="' . $JAVA_OPTS . '"'
let g:test#groovy#maventest#executable = 'mw test'
function! TestCoverage()
unlet! g:test#last_command g:test#last_position g:test#last_strategy
let l:oldOptions = g:test#groovy#maventest#options
let g:test#groovy#maventest#options = g:test#groovy#maventest#defaultoptions
:TestNearest jacoco:report -Pjacoco
let g:test#groovy#maventest#options = l:oldOptions
endfunction
" https://github.com/tpope/vim-dispatch
"--------------------------------------
let g:dispatch_compilers = {}
" https://github.com/dansomething/mdub
let g:dispatch_compilers['mw'] = 'maven3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment