All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Description: Functions for working with Maven projects.
3 " Given a buffer number, find a Maven project root.
4 function! ale#maven#FindProjectRoot(buffer) abort
5 let l:wrapper_path = ale#path#FindNearestFile(a:buffer, 'mvnw')
7 if !empty(l:wrapper_path)
8 return fnamemodify(l:wrapper_path, ':h')
11 let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
14 return fnamemodify(l:pom_path, ':h')
20 " Given a buffer number, find the path to the executable.
21 " First search on the path for 'mvnw' (mvnw.cmd on Windows), if nothing is found,
22 " try the global command. Returns an empty string if cannot find the executable.
23 function! ale#maven#FindExecutable(buffer) abort
24 let l:wrapper_cmd = has('unix') ? 'mvnw' : 'mvnw.cmd'
25 let l:wrapper_path = ale#path#FindNearestFile(a:buffer, l:wrapper_cmd)
27 if !empty(l:wrapper_path) && executable(l:wrapper_path)
38 " Given a buffer number, get a working directory and command to print the
39 " classpath of the root project.
41 " Returns an empty string for the command if Maven is not detected.
42 function! ale#maven#BuildClasspathCommand(buffer) abort
43 let l:executable = ale#maven#FindExecutable(a:buffer)
45 if !empty(l:executable)
46 let l:project_root = ale#maven#FindProjectRoot(a:buffer)
48 if !empty(l:project_root)
51 \ ale#Escape(l:executable) . ' dependency:build-classpath'