Friday, May 19, 2017

Maven errors spanning multiple lines

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

No comments: