Java developers: If you're using the Eclipse LSP in your editor and Maven on the command line, the former will cause problems if you have annotation processors. Several editors use the Eclipse LSP, including VS Code and Emacs.
If you're suffering from random errors with your Lombok, Protobuf or
other annotation processed magic beans, you can use this trick when
running mvn
on the command line:
- Pause Eclipse LSP processes:
pgrep -f org.eclipse.jdt.ls | xargs kill -STOP
- Run Maven as normal:
mvn install
- Resume Eclipse LSP processes:
pgrep -f org.eclipse.jdt.ls | xargs kill -CONT
This took me a long time to figure out.
You can also put this in a shell alias, so you can just type mci
(short for mvn clean install
):
alias mci="pgrep -f org.eclipse.jdt.ls |
xargs kill -STOP ;
mvn clean; mvn install ;
pgrep -f org.eclipse.jdt.ls | xargs kill -CONT;
xeyes"
Happy coding!