During JAlba 2019 I had again met and talked with Maven project chairman Robert Scholte. I’ve taken an opportunity to ask him: what are the most common errors you encounter in people’s Maven projects?
That’s easy – he said – `mvn clean install`
Robert Scholte at JAlba 2019
So we talked some more and it boils down to:
- using
clean
all the time is needless. Clean was needed in Maven 2 era. Why? Cause there were plug-ins which didn’t clean their results up so you could wind up with a result from a previous build showing things no longer true (worse) or interfering with creating a new result (bad, but better, you at least know immediately something’s wrong). Nowadays plug-ins are cleaning up rather well (though there may be exceptions). - and most of the time you don’t want to
install
you just want toverify
– run all the tests, checks, make sure it builds. Install unnecessarily adds theinstall
phase (and related IO) and its plug-ins – lengthening the build process and your feedback loop and rewriting disk files without need.
So, mvn verify
people, or mvn test
even if you’re not into integration tests.