Biggest error in your Maven project? mvn clean install

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:

  1. 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).
  2. and most of the time you don’t want to install you just want to verify – run all the tests, checks, make sure it builds. Install unnecessarily adds the install 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.

Advertisements

3 Comments

    1. Apologies for the waiting time – was speaking at a conference and finishing a job for a customer of mine – both ate my time like cookie monster eats cookies!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s