Friday, May 19, 2017

Re: Maven errors spanning multiple lines



On Fri, May 19, 2017 at 10:06 AM, David Fishburn <dfishburn.vim@gmail.com> wrote:
My mvn compile returns some errors that are a single line, and some error messages that span over multiple lines.

...
 
" Java related build messages
CompilerSet errorformat+=%+I[INFO]\ BUILD\ %m,%Z
CompilerSet errorformat+=%E[ERROR]\ %f:[%l\\,%c]\ %m,%Z
CompilerSet errorformat+=%A[%t%[A-Z]%#]\ %f:[%l\\,%c]\ %m,%Z
CompilerSet errorformat+=%A%f:[%l\\,%c]\ %m,%Z
...
Anyone give a hint at where this can be extended to handle the multiple line error messages.

This appears to be working for me.

I started with the original single errorformat (to make debugging easier):

setl errorformat=%E[ERROR]\ /%f:[%l\\,%c]\ %m,%Z

Then slowly added things to it (line continuation):
setl errorformat=%E[ERROR]\ /%f:[%l\\,%c]\ %m,%C
setl errorformat=%E[ERROR]\ /%f:[%l\\,%c]\ %m,%C,%Z
setl errorformat=%E[ERROR]\ /%f:[%l\\,%c]\ %m,%C%m,%Z
setl errorformat=%E[ERROR]\ /%f:[%l\\,%c]\ %m,%C%m,%Z%m


In the end, to deal with these multiple line strings:

RROR] /C:/my/path/MyClass.java:[187,112] cannot find symbol
[ERROR] symbol:   method getValue()
[ERROR] location: variable measure of type com.sap.iotservices.network.node.data.WSNParsedMeasure
[ERROR] -> [Help 1]

I changed the error format from:

" Java related build messages
CompilerSet errorformat+=%+I[INFO]\ BUILD\ %m,%Z
CompilerSet errorformat+=%E[ERROR]\ %f:[%l\\,%c]\ %m,%Z
CompilerSet errorformat+=%A[%t%[A-Z]%#]\ %f:[%l\\,%c]\ %m,%Z
CompilerSet errorformat+=%A%f:[%l\\,%c]\ %m,%Z

To:

" Java related build messages
CompilerSet errorformat+=%+I[INFO]\ %m,%Z
CompilerSet errorformat+=%+W[WARNING]\ %m,%Z
CompilerSet errorformat+=%E[ERROR]\ %f:[%l\\,%c]\ %m,%C%m,%Z%m
CompilerSet errorformat+=%A[%t%[A-Z]%#]\ %f:[%l\\,%c]\ %m,%C%m,%Z%m
CompilerSet errorformat+=%A%f:[%l\\,%c]\ %m,%C%m,%Z%m


Now I get this output:

MyClassjava|184 col 37 error| incompatible types: java.lang.String cannot be converted to java.lang.Integer
MyClass.java|187 col 76 error| cannot find symbol symbol:   method getObjectId() location: variable measure of type com.sap.iotservices.network.node.data.WSNParsedMeasure
MyClass.java|189 col 31 error| incompatible types: java.lang.String cannot be converted to java.lang.Integer

Instead of:

MyClassjava|184 col 37 error| incompatible types: java.lang.String cannot be converted to java.lang.Integer
MyClass.java|187 col 76 error| cannot find symbol symbol: 
MyClass.java|189 col 31 error| incompatible types: java.lang.String cannot be converted to java.lang.Integer

Hope that helps others.

David

--
--
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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: