What is a Maven POM?

Why I am asking about Maven POMs? I do know, honest. But I often read blog posts or articles about Maven and wonder about the language being used. There’s some very domain specific terms in use here. So I decided to offer some definitions for people starting out with Maven.

Today, we start with POMs. I asked Maurizio Pillitu of SourceSense to define the term for me.

The Project Object Model is a description of your project; it is exactly a model, as stated in its name, it is the breakdown of all the elements of your application: dependencies, repositories, SCM connectors and so on. In a POM you never implement the behavior, you just configure it, using a set of predefined conventions (like src/main/java for sources, src/site for documentation …) The POM acts as a template to finally generate an *Effective POM* which expresses all the executions of all the plugins that must take place during the build.

So a POM is telling you about every major entity in the project. Which Maven needs to know about in order to build the project. I’d summarise a POM as a kind of manifest or packing slip.

Cue man in blue coat:”Yeah, it’s all here. 5 source trees, two version control systems and a bunch of Selenium tests. We ought to have that built by Wednesday.

Maurizio continues:

The POM is one of the biggest evolutions that Maven contributed to the build tooling universe; in the past we were used to implement the behavior of the build; now we describe the prerequisites, assuming that we know what the behavior is, tweaking it a little bit with some configuration.

Which is a really interesting point. If you think Ant or one of it’s ports is a declarative tool, wait until you see a Maven POM file.

Shouts due to Maurizio and also John Smart who did a great Maven talk on Monday night. The M2Eclipse tool will save you from the horror of XML. It’s a full visual editor for POM files (and more).

Image by Tavallai


Tagged

One thought on “What is a Maven POM?

  1. […] a set of short articles regarding Apache Maven; I’ve contributed some thoughts about the POM, the main concept behind the convention over configuration approach introduced by […]

Comments are closed.

%d bloggers like this: