ITeye博客

ant学习笔记(七)

zzkathy · 2008-01-11 16:05 · Markdown

因为某些需求,今天尝试着使用ant中的<mail>task发送邮件,提醒相关人员build成功完成。脚本很简单,摘录ant中的example如下:

<mail mailhost="somehost@xyz.com" mailport="25" subject="Build successful"  charset="utf-8">
  <from address="me@myist.com"/>
  <to address="all@xyz.com"/>
  <message>some international text</message>
</mail>

上午运行的时候没有什么问题,但是下午传到ClareCase上面以后就不行了,抛出如下异常:

[mail] Failed to initialise MIME mail: javax.mail.Address 

Google了一下,发现只有一个人和喵喵有同样的问题,似乎是因为Library Dependencies的问题,然后look up了一下Ant User Manual,无语了——

Note: This task may depend on external libraries that are not included in the Ant distribution. See Library Dependencies for more information.

喵喵要什么时候才能仔细一点呢……

找到了问题,解决起来就简单了n_n

mail.jar Mail task with Mime encoding, and the MimeMail task http://java.sun.com/products/javamail/

activation.jar Mail task with Mime encoding, and the MimeMail task http://java.sun.com/products/javabeans/glasgow/jaf.html

在上述网址中下载第三方API,把其中的mail.jar和activation.jar添加到ANT_HOME/lib下面,再运行ant脚本,就一切OK了~~

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。