Maven errors spanning multiple lines

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

Maven errors spanning multiple lines

David Fishburn-2
My mvn compile returns some errors that are a single line, and some error messages that span over multiple lines.

Single line:

[ERROR] /C:/my/path/MyClass.java:[184,37] incompatible types: java.lang.String cannot be converted to java.lang.Integer


Multi line (2 examples):

[ERROR] /C:/my/path/MyClass.java:[187,76] cannot find symbol [ERROR] symbol:   method getObjectId()
[ERROR] location: variable measure of type com.sap.iotservices.network.node.data.WSNParsedMeasure


[ERROR] /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]


For the 2 maven compiler errorformats I have found on vim.org, neither handle the case where the messages span multiple lines.

Here is the errorformat:

if exists(":CompilerSet") != 2 " older Vim always used :setlocal
    command! -nargs=* CompilerSet setlocal <args>
endif

CompilerSet makeprg=mvn

" POM related messages
CompilerSet errorformat=%E[ERROR]\ %#Non-parseable\ POM\ %f:\ %m\ %#\\@\ line\ %l\\,\ column\ %c%.%#,%Z,
CompilerSet errorformat+=%+E[ERROR]\ %#Malformed\ POM\ %f:%m\ %#\\@\ %.%#\\,\ line\ %l\\,\ column\ %c%.%#,%Z,
" 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

" jUnit related build messages
CompilerSet errorformat+=%+E\ \ %#test%m,%Z
CompilerSet errorformat+=%+E[ERROR]\ Please\ refer\ to\ %f\ for\ the\ individual\ test\ results.

" Misc message removal
CompilerSet errorformat+=%-G%.%#,%Z


Anyone give a hint at where this can be extended to handle the multiple line error messages.

It is hard to say where the multiple line message ends.  I am not sure if you end up specifying that in the errorformat.

For example, do you just consider the next line part of the previous error message if it does not start with a "/" (the beginning of a filename)?

And looking at the last one, the error list ends with an empty:
[ERROR]

Can that be used to single the end of a multiple line error message?





Full output:


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project EdgeFoundryDB: Compilation failure: Compilation failure:
[ERROR] /C:/my/path/MyClass.java:[184,37] incompatible types: java.lang.String cannot be converted to java.lang.Integer
[ERROR] /C:/my/path/MyClass.java:[187,76] cannot find symbol [ERROR] symbol:   method getObjectId()
[ERROR] location: variable measure of type com.sap.iotservices.network.node.data.WSNParsedMeasure
[ERROR] /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]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:



Thank you for any input.

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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven errors spanning multiple lines

David Fishburn-2


On Fri, May 19, 2017 at 10:06 AM, David Fishburn <[hidden email]> 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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...