wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes to send xml files as an attachment  with notification email in hudson Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "to send xml files as an attachment  with notification email in hudson" Watch "to send xml files as an attachment  with notification email in hudson" New topic
Author

to send xml files as an attachment with notification email in hudson

avneet kumar
Greenhorn

Joined: Jun 01, 2011
Posts: 7
Hi,

I have a configured a project in hudson which is generating certain xml files after its execution.I want to attach those file with the notification email being sent after the project's execution.I have installed email-ext plugin but no such option is there.

Please help me out in configuring this.


Thanks in advance
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Have you looked at the docs: http://wiki.hudson-ci.org/display/HUDSON/Email-ext+plugin
Note especially this text in the docs:
email-ext wrote:To see a list of all available email tokens and what they display, you can click the "?" (question mark) associated with the Content Token Reference at the top bottom of the email-ext section on the project configuration screen.

Then following this step, you will see a number of tokens you can insert, including:
email-ext wrote:${FILE, path} - Includes the content of a specified file.
path - The path to the file. Relative to the workspace root.


JBoss In Action
avneet kumar
Greenhorn

Joined: Jun 01, 2011
Posts: 7
Thanks Peter,

I will try to implement this & will let you know the results
avneet kumar
Greenhorn

Joined: Jun 01, 2011
Posts: 7
Hi Peter,

Can you please throw some light on how to setup this token & its corresponding value in project configuration in hudson.
I am facing some problem on setting up this
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

What have you tired so far and what has the result been?
avneet kumar
Greenhorn

Joined: Jun 01, 2011
Posts: 7
Hi Peter,

Is it possible to send a file as an attachment with the Hudson mail notification.

We are trying it with email-ext plugin but the attachment is not coming with the mail, It is simply send the defined parameters as a message in the mail.



You can also find an attachment with this post.


Thanks,
Avneet



[Thumbnail for hudson_mail.JPG]

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Exactly where is index.html located? Is it within your project? Is it located somewhere on the Hudson server? Is it located somewhere on the build slave?
avneet kumar
Greenhorn

Joined: Jun 01, 2011
Posts: 7
This index.html is located in the workspace of hudson...I am just executing simple scenario with hudson only as master...no slave is there....
& this workspace is in the VM machine where hudson is.Here is the path: /root/.hudson/jobs/test/workspace
Mahendra Singh India
Greenhorn

Joined: Aug 16, 2011
Posts: 3
Please suggest me how to use FILE token. I am specifying as what is mentioned in previous post.
my file is present under workspace

I am using :${FILE="pom.xml", path="file path"}.
Its not working. Please suggest on with an example
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Based on reading the help text, I would have though that you would use something like this:

${FILE, pom.xml}
Mahendra Singh India
Greenhorn

Joined: Aug 16, 2011
Posts: 3
Hi Peter,
I have tried with given option as well.
Its simply printing the same in the body part of the mail.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Figure it out.

There is this phrase in the help text regarding the path: "Relative to the workspace root." So the question becomes, what is "the workspace root?" Well, looking at the ~/.hudson/jobs directory, I noticed that for job Foo Bar, there was this directory structure:

~/.hudson/jobs/Foo Bar/workspace/foobar

That last foobar is the project directory from Subversion, and it is that foobar directory that contains my project (that it the Mavne or Ant build script resides there and it is basedir for the builds. However, foobar is not "the workspace root." Instead, the workspace directory is the workspace root.

The other thing I had to figure out is that the syntax for the properties is not well documented. It should really say:

${FILE, path="xxx"} where xxx is the relative path to the file

Thus this worked for me:

${FILE, path="foobar/pom.xml"}

I received an email with the contents of the POM.
Mahendra Singh India
Greenhorn

Joined: Aug 16, 2011
Posts: 3
Hi Peter,

Thanks for the configuration suggested.
It is working fine for me as well.
I am also getting the file as the content. Is there any option by which we can get the file as an attachment.

Regards,
Mahendra
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Is there any option by which we can get the file as an attachment.

Not that I know of. But the plugin is open source, you could always add that capability and submit the patch back to the community.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to send xml files as an attachment with notification email in hudson
 
Similar Threads
Java Coding Contest - Java Books to be won
Please confirm Code works with certificate
Email Notification
Problem in hudson build process
posting a modified hudson build config using Ruby script