[GRADLE-2150] Problem sending mail from a build script Created: 06/Mar/12 Updated: 04/Jan/13 Resolved: 08/Mar/12 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 1.0-milestone-8 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Adam Murdoch |
Resolution: | Fixed | Votes: | 0 |
Description |
I need to send an email from my build script. My code works perfectly as a standalone program; however, when it's in a build script, I get an exception. Here's the script: import org.apache.commons.mail.EmailAttachment; buildscript { dependencies { task sendEmail() { MultiPartEmail mpe = new MultiPartEmail() Here's the last bin of the exception: Caused by: javax.mail.MessagingException: IOException while sending message; |
Comments |
Comment by Gradle Forums [ 06/Mar/12 ] |
This seems to be a strange classloader issue: [1]http://forum.springsource.org/archive.... |
Comment by Gradle Forums [ 06/Mar/12 ] |
Well, I've got a workaround - I just hope it doesn't break other things in strange ways ... I forget if I found it on that post or on another one, but I ended up wrapping my code with: def oldClassLoader = Thread.currentThread().contextClassLoader ... send email ... Thread.currentThread().contextClassLoader = oldClassLoader |