Maven errorformat on windows

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Maven errorformat on windows

David Fishburn-2
I have tried 2 different maven compiler plugins, both have the same issue, so I believe it is related to how the filename is returned from maven on windows.

When I run mvn from the command line I get this output:

[ERROR] /C:/my/path/to/MyClass.java:[178,26] cannot find symbol [ERROR] symbol:   class Value

And the resulting error opened in Vim is:

 11 %a   "\C:\my\path\to\MyClass.java"

The errorformat always references the filename like this:
    CompilerSet errorformat+=%E[ERROR]\ %f:[%l\\,%c]\ %m,%Z

I simply modified the errorformat on Windows to add a "/" before the filename to strip it off:
    CompilerSet errorformat+=%E[ERROR]\ /%f:[%l\\,%c]\ %m,%Z

But I did this just using a substitute command at the end of the mvn compiler command:

if has('win32') || has('win64') 
    " Maven produces these errors on Windows
    " [ERROR] /C:/my/path/to/MyClass.java:[178,26] cannot find symbol [ERROR]
    " symbol:   class Value
    " And the resulting error opened in Vim is:
    " :ls!
    "  11 %a   "\C:\my\path\to\MyClass.java"
    " That file does not exist, so this will alter the 
    " errorformat and remove the leading "/" from the filename
    let &l:errorformat = substitute(&errorformat, '%f', '/&', 'g')

This works like a charm.

Does this make sense, or is some some other "Vimish" way to do this with isfname and so on ....


You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.