git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@533617 13f79535-47bb-0310-9956-ffa450edef68
72 lines
2.9 KiB
XML
72 lines
2.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
/*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership.
|
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
* (the "License"); you may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
-->
|
|
|
|
<faqs title="Frequently Asked Questions">
|
|
|
|
<part id="general">
|
|
<title>General</title>
|
|
|
|
<faq id="how-to-mail">
|
|
<question>
|
|
How do I email a test report?
|
|
</question>
|
|
<answer>
|
|
<p>
|
|
The following sample code will email a test report if there are any failures:
|
|
</p>
|
|
<source><![CDATA[<postGoal name="maven-junit-report-plugin:report">
|
|
<j:if test="${maven.test.failure}">
|
|
<j:set var="mailReport" value="${test.mail.report}" />
|
|
<j:if test="${mailReport}">
|
|
<attainGoal name="mail-test-report" />
|
|
</j:if>
|
|
</j:if>
|
|
</postGoal>
|
|
|
|
<goal name="mail-test-report">
|
|
${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')}
|
|
<ant:style in="${maven.build.dir}/TESTS-TestSuites.xml" out="${maven.build.dir}/junit-report-mail.html" style="${basedir}/overview-summary.xsl" />
|
|
|
|
<ant:tstamp/>
|
|
<ant:mail messageMimeType="text/html" messageFile="${maven.build.dir}/junit-report-mail.html"
|
|
subject="[BUILD] JUnit Test Results for ${pom.artifactId}: ${TODAY}" tolist="${pom.build.nagEmailAddress}
|
|
">
|
|
<ant:from name="Build Master" address="someone@nowhere.com.au" />
|
|
</ant:mail>
|
|
</goal>]]></source>
|
|
<p>
|
|
Include this in your <code>maven.xml</code> file, and set the property <code>test.mail.report</code>
|
|
to <code>true</code> for the users that you want to send the mail from (typically just you continuous
|
|
integration environment).
|
|
</p>
|
|
<p>
|
|
Note that you have to include Xalan in your dependencies for this particular example (see the main
|
|
<a href="http://maven.apache.org/faq.html">Maven FAQ</a> for more information), and provide the
|
|
<code>overview-summary.xsl</code> file in your project's base directory. An example one is
|
|
distributed with Ant in <code>etc/junit-noframes.xsl</code>.
|
|
</p>
|
|
<p>
|
|
If you want to receive successful reports, exclude the <code><![CDATA[<j:if test="${maven.test.failure}">]]></code> condition.
|
|
</p>
|
|
</answer>
|
|
</faq>
|
|
</part>
|
|
</faqs>
|