The Maven Way™

Written by: Stephen Connolly
2 min read

If you follow the Apache Maven mailing lists, there is an oft-invoked but never defined term that crops up:

The Maven Way™

(Ok, so it's not really a trademark. Apache, Apache Maven and Maven are all trademarks of the Apache Software Foundation though)

Well as part of a conversation on the mailing list, it seems I may have hit upon a definition by example of what exactly The Maven Way is:

<project>
  <groupId>…</groupId>
  <artifactId>…</artifactId>
  <version>…</version>
  <packaging>…</packaging>
  <dependencies>
  </dependencies>
</project>

The more lines you add to the above project template, the further from The Maven Way you are.

It's not wrong to be far from The Maven Way… it's just a difficult and uncomfortable place to be.

To quote another subscriber to the mailing list

The above describes what the project is . The more you have to tinker with plugins and the like, the more likely you are describing how the project should be built .

...

Maven exists to figure out how after you have told it what .

- Mark Wood

When building new types of things it's ok, perhaps even expected, to venture far from The Maven Way… but once you figure out how that new type of thing should be built, the idea is to codify that best practice into plugins and if necessary a packaging type so that others need only say <packaging>new-type-of-thing</packaging> (See note below) and they are right there on The Maven Way for building that new type of thing.

Note: of course when referencing a packaging type that is not in the default list (i.e. jar,war,ear,rar,pom) you will need to add the lines defining the <extension> that defines the packaging type, but that is far far closer to The Maven Way than adding 15 plugin definitions with configuration to hijack an existing packaging type and subvert it for the purpose of building a new type of thing.

—Stephen Connolly
CloudBees
cloudbees.com

Stephen Connolly has over 20 years experience in software development. He is involved in a number of open source projects, including Jenkins . Stephen was one of the first non-Sun committers to the Jenkins project and developed the weather icons. Stephen lives in Dublin, Ireland - where the weather icons are particularly useful. Follow Stephen on Twitter and on his blog .

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.