November 25, 2008

Maven 2 - maven-changes-plugin - with email notification and changes.xml validation

One very usefull feature of Maven is that when you release your project a notification can be sent out to the Dev/QA teams and a changes.html page can be created in the maven site.
The following is how to do that

1. Add the following plugin to pom.xml

1.1 Setup from and to emails

   <>Release Mailler</>
   <> </></properties>

1.2 Add the plugin

  <smtpPort implementation="java.lang.Integer">25</smtpPort>
       <toAddress implementation="java.lang.String">${}</toAddress>
       <toAddress implementation="java.lang.String">${}</toAddress>
  <developmentTeam> Team</developmentTeam>
  <introduction> This is a notification email that the ${project.version} build of ${} has been code reviewed and deployed to Repository. Change list can be viewed on ${project.url}/changes-report.html</introduction>

2. Create a changes.xml in /src/changes/changes.xml

<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="" xmlns:xsi="" xsi:schemaLocation="">
        <title>Change Log for My App</title>
        <release version="1.0.1" description="1st release" date="11/11/08">
            <action dev="gdawoud" issue="12344" type="fix">Add a fix for bug</action>
        <release version="1.0" description="1st release" date="11/11/08">
            <action dev="gdawoud" issue="12344" type="fix">Add a fix for bug</action>

And that is it.

Note: The changes plugin has an issue where if the changes.xml does not include an entry for a release matching the build release version, the build will fail after deploying the war/jar/etc to the maven repository. To Fix that you will have to check in an updated changes.xml with a matching release and retag it with the release tag then call cvs update and mvn release:prepare again

Check out the follow up blog 


  1. Hi George,
    I also use changes plugin but try to configure it and run with
    mvn changes:announcement-mail
    only for root module of multi-module project. Unfortunately after mail was successfully sent for root module, Maven tries to do the same for sub-modules and (I think it does it correctly) fails with
    "Announcement template D:\dibs\release\test\test-core\target\announcement\announcement.vm not found"
    Is there any way to avoid running announcement-mail goal for submodules? I'm in process of searching...

  2. Hi Alex,

    i also use a multi-module project but i never build it from the root, i tend to want to build each subject when it is needed... so i have no tried that...

    the best way i found ways to solve or a bug fix is to go into each plugin's bug tracking system and there is always an answer... not sure why they are listed on google.

  3. Thanks George,
    It seems that for my situation there is no simple solution - I can not bind send mail goal to any valid lifecycle since release plugin does not have any, also pom does not support something like <nonRecursive> element for concrete plugin. So the only way is to provide - option directly in the command line:
    mvn changes:announcement-mail -N
    Hope one day we will have another way:)

  4. Declaration and execution of annoucement-generate goal is useless because redundant :
    announcement-mail executes automatically
    announcement-generate first.

    plugin goal documentation :
    Before this mojo executes, it will call:Single mojo: 'announcement-generate'