Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errorformat for maven3 in vim

Tags:

java

vim

maven-3

I'm running maven 3 from vim and I'm partially successful in getting the error format defined. Here's what I have now:

makeprg=mvn compile -q -f pom.xml

errorformat=[ERROR]\ %f:[%l%.%c]%m

Maven3 build error:

    :!mvn compile -q -f pom.xml  2>&1| tee /var/folders/qy/qyYtxIV9EECvBoYr30SmkU+++TM/-Tmp-/vemUiQM/6
[debug] execute contextualize
[ERROR] COMPILATION ERROR : 
[ERROR] /Users/mackie/source-checkouts/carbon/components/bam2/org.wso2.carbon.bam.clustermonitor.ui/src/main/java/org/wso2/carbon/bam/clustermonitor/ui/ClusterAdminClient.java:[84,9] not a statement

[ERROR] /Users/mackie/source-checkouts/carbon/components/bam2/org.wso2.carbon.bam.clustermonitor.ui/src/main/java/org/wso2/carbon/bam/clustermonitor/ui/ClusterAdminClient.java:[84,10] ';' expected

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project org.wso2.carbon.bam.clustermonitor.ui: Compilation failure: Compilation failure:
[ERROR] /Users/mackie/source-checkouts/carbon/components/bam2/org.wso2.carbon.bam.clustermonitor.ui/src/main/java/org/wso2/carbon/bam/clustermonitor/ui/ClusterAdminClient.java:[84,9] not a statement
[ERROR] 
[ERROR] /Users/mackie/source-checkouts/carbon/components/bam2/org.wso2.carbon.bam.clustermonitor.ui/src/main/java/org/wso2/carbon/bam/clustermonitor/ui/ClusterAdminClient.java:[84,10] ';' expected
[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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

The problem now is that I get additional, unnecessary lines in my quickfix list:

|| [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project org.wso2.carbon.bam.clustermonitor.ui: Compilation failure: Compilation f#
  8 src/main/java/org/wso2/carbon/bam/clustermonitor/ui/ClusterAdminClient.java|84 col 9| not a statement
  9 || [ERROR].
 10 src/main/java/org/wso2/carbon/bam/clustermonitor/ui/ClusterAdminClient.java|84 col 10| ';' expected
 11 || [ERROR] -> [Help 1]
 12 || [ERROR].
 13 || [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
 14 || [ERROR] Re-run Maven using the -X switch to enable full debug logging.
 15 || [ERROR].
 16 || [ERROR] For more information about the errors and possible solutions, please read the following articles:
 17 || [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException    

How do I tune the error format better to get only the errors to appear in the quick fix list?

like image 483
dev_nut Avatar asked Feb 21 '23 16:02

dev_nut


2 Answers

I found a working Maven 3 errorformat here:

set errorformat=[ERROR]\ %f:[%l\\,%v]\ %m
like image 172
Ben Williams Avatar answered Mar 02 '23 23:03

Ben Williams


Read up on :help errorformat-multi-line and :help efm-ignore. It's also helpful to investigate how other compiler plugins define their 'errorformat'.

like image 43
Ingo Karkat Avatar answered Mar 02 '23 23:03

Ingo Karkat