Home > Maven > Maven – replacing < name > with something more meaningful (groupId:artifactId)

Maven – replacing < name > with something more meaningful (groupId:artifactId)

Maven uses POM’s <name> tag content when printing:

  • Reactor build order
  • Building a module
  • Reactor Summary

From my experience, people don’t really pay much attention to that tag. Some just copy <artifactId> there (that was me for a long time), others provide kind of project description there.
But whatever the case is – it usually takes some time to understand what Maven is building right now when there are lot’s of modules running since all that’s displayed is <name>! Personally, I never understood why someone would print this <name> tag instead of “<groupId>:<artifactId>” (even opened a JIRA case) – after all, I think their combination provides a pretty good description of a project (in fact, when <name> is missing – that’s exactly what Maven prints).

But now, after having a script (which is very different today from that initial version, my Groovy skills are improving) to iterate over all POMs in order to replace their <groupId> – it was a natural step for me to replace <name> tags as well: 🙂

text.replaceFirst( /<name>(.+?)<\/name>/,
                   "<name>[${ groupId }:${ artifactId }]-[${ svnPath }]</name>" );

Where ${groupId} and ${artifactId} are taken from the POM and ${svnPath} is POM’s path in SVN.

Something like:


Now, when Maven runs we see bunch of new <name>s displayed giving an exact and immediate information about what POMs are aggregated and built.


And it looks lovely in Hudson too!


It now runs automatically (using GMaven plugin) as part of Hudson nightly build so each new POM gets a correct <name> on the following day.

Categories: Maven Tags:
  1. No comments yet.
  1. July 18, 2009 at 18:32
  2. March 19, 2011 at 02:25

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

%d bloggers like this: