ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Corley \(AT/LMI\)" <david.cor...@ericsson.com>
Subject RE: HTML tags inside ANT..?
Date Wed, 20 Sep 2006 08:16:41 GMT
Whoops. The last mail was empty. Sorry about that.
	As for composing the HTML inside Ant, I've done that too, but be warned it ain't pretty!
	What I did was have a standard html file that I used as a mail template. Within that html
file, I had several filter keys (such as @date@, @username@, etc).
	So before I sent the build mail, I copied the html file from the template to some temp directory,
running a filterset on it as the copy took place, thereby replacing the filter keys with html
code (that I had defined in build.xml).
	The real pain in the ass is having to use a lot of escape characters so that Ant doesn't
think your markup is part of the build script.
	For instance the code below replaces filter keys in my template html code with links to documents
created as part of the build process.
	
<copy todir="${output.dir}/OverallPMD">
	<fileset dir="${nav.dir}/PMD"/>
		<filterset>
		<filter token="OVERQR3" value="&lt;a href=&quot;../OverallPMD/QR3ONLY-PMD-OVERALL.html&quot;
target=&quot;bottomFrame&quot;&gt;QRANK3"/>
		<filter token="OVERQR4" value="&lt;a href=&quot;../OverallPMD/QR4ONLY-PMD-OVERALL.html&quot;
target=&quot;bottomFrame&quot;&gt;QRANK4"/>
		<filter token="OVERQR5" value="&lt;a href=&quot;../OverallPMD/QR5ONLY-PMD-OVERALL.html&quot;
target=&quot;bottomFrame&quot;&gt;QRANK5"/>
		<filter token="OVERQR6" value="&lt;a href=&quot;../OverallPMD/QR6ONLY-PMD-OVERALL.html&quot;
target=&quot;bottomFrame&quot;&gt;QRANK6"/>
		<filter token="OVERQR7" value="&lt;a href=&quot;../OverallPMD/QR7ONLY-PMD-OVERALL.html&quot;
target=&quot;bottomFrame&quot;&gt;QRANK7"/>
		<filter token="OVERQR8" value="&lt;a href=&quot;../OverallPMD/QR8ONLY-PMD-OVERALL.html&quot;
target=&quot;bottomFrame&quot;&gt;QRANK8"/>
	</filterset>
</copy>

The corresponding html template is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style></head>

<body>
<table width="100%" border="0">
  <tr>
    <td bgcolor="#CCCCCC"><span class="style1">OVERALL:</span></td>
    <td bgcolor="#66FF66"><div align="center" class="style1">@OVERQR3@</div></td>
    <td bgcolor="#CCFFCC"><div align="center" class="style1">@OVERQR4@</div></td>
    <td bgcolor="#FFFFCC"><div align="center" class="style1">@OVERQR5@</div></td>
    <td bgcolor="#FFFF00"><div align="center" class="style1">@OVERQR6@</div></td>
    <td bgcolor="#FFCC33"><div align="center" class="style1">@OVERQR7@</div></td>
    <td bgcolor="#FF9900"><div align="center" class="style1">@OVERQR8@</div></td>
  </tr>
</table>
</body>
</html>

Now there
See how messy that can get? Now it works well, but you have to have the patience of a saint
to work through it all. 
Maybe I still don't understand what you want to do, but I think you're at least getting a
better picture of what CAN be done.

/Dave 

-----Original Message-----
From: anandsrider.d@polaris.co.in [mailto:anandsrider.d@polaris.co.in] 
Sent: 20 September 2006 09:50
To: Ant Users List
Subject: RE: HTML tags inside ANT..?


Jan/David,

Thanx for ur supportive suggestions.

Real scenario here is ....

Once the build is thru' am checking for Build Success/Failure in a shell script . Depending
on tht the shell script call seperate mail tasks inside same build.xml

for Success/Failure.Presently I want to include some HTML tags inside those mail tasks to
get reflected in the mail. ( Now mail generation is done
successfully)
I want to happen everything in runtime.

Jan, i will try the way u suggest. But I prefer tht to be inside by build file....

---- anand




                                                                                         
                                             
                      "David Corley                                                      
                                             
                      \(AT/LMI\)"              To:      "Ant Users List" <user@ant.apache.org>
                                        
                      <david.corley@er         cc:      (bcc: anandsrider.d/Polaris)  
                                                
                      icsson.com>              Subject: RE: HTML tags inside ANT..?   
                                                
                                                                                         
                                             
                      09/20/2006 12:47                                                   
                                             
                      PM                                                                 
                                             
                      Please respond                                                     
                                             
                      to "Ant Users                                                      
                                             
                      List"                                                              
                                             
                                                                                         
                                             
                                                                                         
                                             




I agree with Jan,
             I've a setup pretty close to what you're looking for in use at work.
             But to do this you'll need to add the javamail and jaf jars to the ant bootloader
classpath...
             Which you can do more or less as follows:

             ant -f build.xml -lib /directory/containing/javamail.jar/ -lib /directory/containing/jaf.jar/

             If you don't add the directories containing those two jars, Ant won't be able
to process MIME mail, and will send a UUE encoded message instead, which will result in your
mail showing the HTML source code instead of the properly formatted content.
             You can grab javamail here:
             http://java.sun.com/products/javamail/downloads/index.html
             And you can grab JAF (JavaBeans Activation Framework) here:

http://java.sun.com/products/javabeans/jaf/downloads/index.html

Hope this helps,
/Dave



-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
Sent: 20 September 2006 08:08
To: user@ant.apache.org
Subject: AW: HTML tags inside ANT..?

<mail>
    <message src="message.html" mimetype="text/html"/> </mail>

I would use an external message-file, because html (message) inside xml
(buildfile) is very hard to maintain ...


Jan

>-----Urspr√ľngliche Nachricht-----
>Von: anandsrider.d@polaris.co.in [mailto:anandsrider.d@polaris.co.in]
>Gesendet: Mittwoch, 20. September 2006 07:14
>An: user@ant.apache.org
>Betreff: HTML tags inside ANT..?
>
>
>Hi,
>
>Presently am using ant 1.5.4 version for building java application. I 
>used to generate mails to Lotus Notes server upon either build success 
>or failure.
>
>Presently the mail generated will have some texts and attached error 
>log file. I want to use HTML tags inside ant and expexting the 
>generated mail should
>
>looks like a HTML page.
>
>Any body have idea abt this,  which will be helpful
>
>rgds,
>anand
>
>This e-Mail may contain proprietary and confidential information and is 
>sent for the intended recipient(s) only.
>If by an addressing or transmission error this mail has been 
>misdirected to you, you are requested to delete this mail immediately.
>You are also hereby notified that any use, any form of reproduction, 
>dissemination, copying, disclosure, modification, distribution and/or 
>publication of this e-mail message, contents or its attachment other 
>than by its intended recipient/s is strictly prohibited.
>
>Visit us at http://www.polaris.co.in
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional 
>commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org



This e-Mail may contain proprietary and confidential information and is sent for the intended
recipient(s) only.  If by an addressing or transmission error this mail has been misdirected
to you, you are requested to delete this mail immediately. You are also hereby notified that
any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution
and/or publication of this e-mail message, contents or its attachment other than by its intended
recipient/s is strictly prohibited.

Visit us at http://www.polaris.co.in

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message