Being a lazy developer, I was recently searching for a way to automatically generate release notes instead of manually compiling the list. Fortunately, the maven changes plugin comes to the rescue. It can not only generate the release notes from JIRA tasks, but also email it to a list of email addresses.
I’m writing this post to collect all scattered information from different sources into a single place and provide a working example as I couldn’t find one on the internet.
Sample pom.xml
... <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> <version>2.11</version> <executions> <execution> <id>include-announcement-file</id> <phase>generate-resources</phase> <goals> <goal>announcement-generate</goal> </goals> <configuration> <!-- This will generate CHANGES.txt file under META-INF folder within the built artifact: --> <announcementFile>CHANGES.txt</announcementFile> <announcementDirectory>${project.build.outputDirectory}/META-INF</announcementDirectory> </configuration> </execution> </executions> <configuration> <issueManagementSystems> <issueManagementSystem>JIRA</issueManagementSystem> </issueManagementSystems> <smtpHost>mail.yourhost.com</smtpHost> <smtpPort implementation="java.lang.Integer">25</smtpPort> <mailSender> <name>Release Notification</name> <email>build@example.com</email> </mailSender> <toAddresses> <toAddress implementation="java.lang.String">to@example.com</toAddress> </toAddresses> <useJql>true</useJql> <!-- Use current build version: --> <onlyCurrentVersion>true</onlyCurrentVersion> <!-- use this to define a specific version: <fixVersionIds>11412</fixVersionIds> --> <resolutionIds>Fixed,Done</resolutionIds> <statusIds>Closed,Resolved,QA</statusIds> <columnNames>Type,Key,Summary,Priority,Status,Resolution,Fix Version,Assignee</columnNames> <webUser>myuser</webUser> <webPassword>mypassword</webPassword> </configuration> </plugin> </plugins> </build> ... <issueManagement> <system>JIRA</system> <url>https://abc.jira.com/browse/XY</url> </issueManagement> ... <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> <version>2.11</version> </plugin> </plugins> </reporting> ...
Generate release notes html file
Run this command:
mvn changes:jira-report
Here’s a sample JIRA report:
https://maven.apache.org/plugins/maven-changes-plugin/jira-report.html
Generate and send email
Run this command:
mvn changes:announcement-mail
This will also be executed when deploying artifact to a maven repository using:
mvn deployThe selected Optin Cat form doesn't exist.