Hi,

I've been meaning to clean this up and add it for a while, but here is the
idea. Maybe I'll add a wiki page in the meantime.
The main obstacle at the moment is obtaining overview-summary.xsl from
somewhere that it can be included in Maven. The one I use comes from one of
the various ant tutorials on the subject. Possibly it just requires a
modified version of the one already in the report plugin.

Once including this in maven.xml, set the property maven.test.mail.report to
enable mail and change the from address, then create overview-summary.xsl
and put it in the base directory.

  <postGoal name="maven-junit-report-plugin:report">
    <j:if test="${maven.test.failure}">
      <j:set var="mailReport" value="${maven.test.mail.report}" />
      <j:if test="${mailReport}">
        <attainGoal name="test:mail-report" />
      </j:if>
    </j:if>
  </postGoal>

  <goal name="test:mail-report">
 
${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apac
he.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="JUnit Test
Results for ${pom.artifactId}: ${TODAY}"
tolist="${pom.build.nagEmailAddress}">
      <ant:from name="Build Master" address="[EMAIL PROTECTED]" />
    </ant:mail>
  </goal>

--
Brett Porter
Team Leader, Core Systems
f2 network ~ everything essential


> -----Original Message-----
> From: K.C. Baltz [mailto:[EMAIL PROTECTED] 
> Sent: Friday, 25 July 2003 7:26 AM
> To: [EMAIL PROTECTED]
> Subject: Revisiting Sending email with Maven
> 
> 
> Looking through the archives, I saw a discussion at the 
> beginning of the 
> month on how to send an email when the Tests fail.  I have a need for 
> that and I was curious what if any progress had been made.  
> Someone had 
> mentioned "postgoals".  I'm fairly new to Maven and don't 
> recall seeing 
> those in the docs.  Could someone point me at them if that's 
> the way to 
> go for now?
> 
> K.C.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to