postman:surefire-mail

Full name:

ch.fortysix:maven-postman-plugin:0.1.6:surefire-mail

Description:

Sends mails based on surefire (test) results.

Attributes:

  • Requires a Maven 2.0 project to be executed.
  • Binds by default to the lifecycle phase: site.

Required Parameters

Name Type Since Description
from String - Email address of sender.
receivers Set - Who should receive a mail? One can use an id of a developer registered in the pom or an email address directly.
<receivers>
<receiver>developerId</receiver>
<receiver>sam@topland.com</receiver>
</receivers>

Optional Parameters

Name Type Since Description
failonerror boolean - flag to indicate whether to halt the build on any error. The default value is true.
Default value is: true.
groovyCondition String - This allows to redefine the condition to send the mail. e.g. one can define that there must not be more then 20 skipped test cases (skipped > 20). The default condition sends mails if there are any errors. The following variables are available for usage in the condition:
  • errors: number of all errors while running surefire
  • skipped: number of all skipped test cases
  • failures: number of all failures in the test cases
  • total: number of all test cases
Other (usefull or not...) examples:
  • errors > 0 : sends a mail only if there are errors
  • skipped > failures : sends mails if there are more skipped then failed test cases
  • total == skipped : Sends mails if all tests are skipped
To avoid problems with XML syntax, one can use a CDATA element. The default only send a mail if there are errors or failures, but ignores the skipped ones.
Default value is: errors > 0 || failures > 0.
htmlMessage String - The html message body to be send
Default value is: <body>build for ${project.groupId}:${project.artifactId}:${project.version} executed</body>.
htmlMessageFile File - The html message body to be send, if set the content of this will replace the htmlMessage.
mailAltConfig boolean - Indicates to use an alternative way to configure the ssl connection to the smtp server. This might be needed in specific environments.
Default value is: false.
mailcontenttype String - The content type to use for the message. This is only the fallback contenttype if the environment does not support 'multipart/alternative'.
Default value is: text/html.
mailhost String - Host name of the SMTP server. The default value is localhost.
Default value is: localhost.
mailpassword String - Password for SMTP auth
mailport String - TCP port of the SMTP server. The default value is 25.
Default value is: 25.
mailssl boolean - Indicates whether you need TLS/SSL
Default value is: false.
mailuser String - User name for SMTP auth
multipartSupported boolean - Whether 'multipart/alternative' mails can be send. This is detected automatically, but it allows a user to disable it and force the usage of 'mailcontenttype'.
Default value is: true.
outputDirectory File - Report output directory. Note that this parameter is only relevant if the goal is run from the command line or from the default build lifecycle. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
Default value is: ${project.reporting.outputDirectory}.
reportFilePattern String - The file pattern to be used to search for the surefire reports in the 'testReportsDirectory'-directory.
Default value is: TEST-.*.xml.
skip boolean - Indicates whether this report should skip the sending mails (no mails send).
Default value is: false.
sourceEncoding String - Encoding of the source. Advice is taken from: POM Element for Source File Encoding
Default value is: ${project.build.sourceEncoding}.
subject String - Email subject line.
Default value is: [${project.artifactId}].
surefireReportHtml File - The generated surefire html report (previously generated by 'maven-surefire-report-plugin').
Default value is: ${project.build.directory}/site/surefire-report.html.
testReportsDirectory File - Base directory where all surefire test reports are read from.
Default value is: ${project.build.directory}/surefire-reports.
textMessage String - The text message to be send
Default value is: build for ${project.groupId}:${project.artifactId}:${project.version} executed.
textMessageFile File - The text message body to be send, if set the content of this will replace the textMessage.

Parameter Details

failonerror:

flag to indicate whether to halt the build on any error. The default value is true.
  • Type: boolean
  • Required: No
  • Default: true

from:

Email address of sender.
  • Type: java.lang.String
  • Required: Yes

groovyCondition:

This allows to redefine the condition to send the mail. e.g. one can define that there must not be more then 20 skipped test cases (skipped > 20). The default condition sends mails if there are any errors. The following variables are available for usage in the condition:
  • errors: number of all errors while running surefire
  • skipped: number of all skipped test cases
  • failures: number of all failures in the test cases
  • total: number of all test cases
Other (usefull or not...) examples:
  • errors > 0 : sends a mail only if there are errors
  • skipped > failures : sends mails if there are more skipped then failed test cases
  • total == skipped : Sends mails if all tests are skipped
To avoid problems with XML syntax, one can use a CDATA element. The default only send a mail if there are errors or failures, but ignores the skipped ones.
  • Type: java.lang.String
  • Required: No
  • Default: errors > 0 || failures > 0

htmlMessage:

The html message body to be send
  • Type: java.lang.String
  • Required: No
  • Default: <body>build for ${project.groupId}:${project.artifactId}:${project.version} executed</body>

htmlMessageFile:

The html message body to be send, if set the content of this will replace the htmlMessage.
  • Type: java.io.File
  • Required: No

mailAltConfig:

Indicates to use an alternative way to configure the ssl connection to the smtp server. This might be needed in specific environments.
  • Type: boolean
  • Required: No
  • Default: false

mailcontenttype:

The content type to use for the message. This is only the fallback contenttype if the environment does not support 'multipart/alternative'.
  • Type: java.lang.String
  • Required: No
  • Default: text/html

mailhost:

Host name of the SMTP server. The default value is localhost.
  • Type: java.lang.String
  • Required: No
  • Expression: ${mailhost}
  • Default: localhost

mailpassword:

Password for SMTP auth
  • Type: java.lang.String
  • Required: No

mailport:

TCP port of the SMTP server. The default value is 25.
  • Type: java.lang.String
  • Required: No
  • Expression: ${mailport}
  • Default: 25

mailssl:

Indicates whether you need TLS/SSL
  • Type: boolean
  • Required: No
  • Default: false

mailuser:

User name for SMTP auth
  • Type: java.lang.String
  • Required: No

multipartSupported:

Whether 'multipart/alternative' mails can be send. This is detected automatically, but it allows a user to disable it and force the usage of 'mailcontenttype'.
  • Type: boolean
  • Required: No
  • Default: true

outputDirectory:

Report output directory. Note that this parameter is only relevant if the goal is run from the command line or from the default build lifecycle. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
  • Type: java.io.File
  • Required: No
  • Default: ${project.reporting.outputDirectory}

receivers:

Who should receive a mail? One can use an id of a developer registered in the pom or an email address directly.
<receivers>
<receiver>developerId</receiver>
<receiver>sam@topland.com</receiver>
</receivers>
  • Type: java.util.Set
  • Required: Yes

reportFilePattern:

The file pattern to be used to search for the surefire reports in the 'testReportsDirectory'-directory.
  • Type: java.lang.String
  • Required: No
  • Default: TEST-.*.xml

skip:

Indicates whether this report should skip the sending mails (no mails send).
  • Type: boolean
  • Required: No
  • Default: false

sourceEncoding:

Encoding of the source. Advice is taken from: POM Element for Source File Encoding
  • Type: java.lang.String
  • Required: No
  • Expression: ${encoding}
  • Default: ${project.build.sourceEncoding}

subject:

Email subject line.
  • Type: java.lang.String
  • Required: No
  • Default: [${project.artifactId}]

surefireReportHtml:

The generated surefire html report (previously generated by 'maven-surefire-report-plugin').
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/site/surefire-report.html

testReportsDirectory:

Base directory where all surefire test reports are read from.
  • Type: java.io.File
  • Required: No
  • Expression: ${project.build.directory}/surefire-reports
  • Default: ${project.build.directory}/surefire-reports

textMessage:

The text message to be send
  • Type: java.lang.String
  • Required: No
  • Default: build for ${project.groupId}:${project.artifactId}:${project.version} executed

textMessageFile:

The text message body to be send, if set the content of this will replace the textMessage.
  • Type: java.io.File
  • Required: No