I would highly recommend using the CI tool to manage this for you. I personally like to configure which emails to send in the assembly to avoid spam. For example, only notify when an assembly starts to fail or starts working again, and not every time it fails.
If you are sure this is the right approach, you can use the maven-changes-plugin to send email for each build. You can configure the mail template with speed and link the fulfillment of goals to the corresponding phase so that it is sent when you want it.
I also put the configuration in the profile so it was sent when you want it to be (for example, when the profile is active).
The configuration looks something like this:
<profiles> <profile> <id>notify</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> <executions> <execution> <phase>install</phase> <goals> <goal>announcement-mail</goal> </goals> </execution> </executions> <configuration> <smtpHost>mail.yourhost.com</smtpHost> <smtpPort implementation="java.lang.Integer">25</smtpPort> <toAddresses> <toAddress implementation="java.lang.String"> someones@email.com </toAddress> <toAddress implementation="java.lang.String"> someoneelse@email.com </toAddress> </toAddresses> <template>announcement.vm</template> <templateDirectory>mailTemplate</templateDirectory> </configuration> </plugin> </plugins> </build> </profile> </profiles>
source share